JBoss Tools SVN: r25972 - trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-21 09:42:24 -0400 (Thu, 21 Oct 2010)
New Revision: 25972
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
Log:
[JBIDE-7371] corrected test against http status code 404
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java 2010-10-21 13:40:45 UTC (rev 25971)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java 2010-10-21 13:42:24 UTC (rev 25972)
@@ -71,10 +71,10 @@
}
};
errorClient.listImages();
+ fail("no exception catched");
} catch (Exception e) {
assertEquals(DeltaCloudClientException.class, e.getClass());
}
- fail("no exception catched");
}
@Test
14 years, 2 months
JBoss Tools SVN: r25971 - trunk/deltacloud/tests/org.jboss.tools.deltacloud.test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-21 09:40:45 -0400 (Thu, 21 Oct 2010)
New Revision: 25971
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/deltacloud-dependencies.jar
Log:
[JBIDE-7371] added tests for 404 on bad requests, changed
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/deltacloud-dependencies.jar
===================================================================
(Binary files differ)
14 years, 2 months
JBoss Tools SVN: r25970 - in trunk/deltacloud: plugins/org.jboss.tools.deltacloud.core/.settings and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-21 09:39:41 -0400 (Thu, 21 Oct 2010)
New Revision: 25970
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.settings/net.sf.jautodoc.prefs
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
Removed:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.classpath
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog
Log:
[JBIDE-7371] added tests for 404 on bad requests, changed
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.classpath
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.classpath 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.classpath 2010-10-21 13:39:41 UTC (rev 25970)
@@ -3,8 +3,8 @@
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="lib/httpclient-4.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpclient-4.0.1.jar" sourcepath="/home/adietisheim/jboss-workspaces/jboss-tools/jbosstools-src/deltacloud/httpcomponents-client-4.0.3-src.zip"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar" sourcepath="/home/adietisheim/jboss-workspaces/jboss-tools/jbosstools-src/deltacloud/httpcomponents-core-4.0.1-src.zip"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore-nio-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpmime-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/apache-mime4j-0.6.jar"/>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.settings/net.sf.jautodoc.prefs
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.settings/net.sf.jautodoc.prefs (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.settings/net.sf.jautodoc.prefs 2010-10-21 13:39:41 UTC (rev 25970)
@@ -0,0 +1,6 @@
+#Thu Oct 21 13:54:40 CEST 2010
+add_header=true
+eclipse.preferences.version=1
+header_text=/*******************************************************************************\n * Copyright (c) 2010 Red Hat, Inc.\n * Distributed under license by Red Hat, Inc. All rights reserved.\n * This program is made available under the terms of the\n * Eclipse Public License v1.0 which accompanies this distribution,\n * and is available at http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * Red Hat, Inc. - initial API and implementation\n ******************************************************************************/
+project_specific_settings=true
+replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/.settings/net.sf.jautodoc.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-10-21 13:39:41 UTC (rev 25970)
@@ -1,3 +1,9 @@
+2010-10-21 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
+ (getRequest): extracted to its own method, changed to switch (from if-else)
+ (sendRequest): added http status code check (latest deltacloud 0.0.8 now reports 404 on missing resource)
+
2010-10-20 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (getDeltaCloudType): moved from UI to deltacloud client
@@ -2,3 +8,3 @@
(DCNS): Added API enum (for api requests)
- (getServerType): moved to instance method, reuse existing client code
+ (getServerType): moved to instance method, reuse existing client code (instead of duplication)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-10-21 13:39:41 UTC (rev 25970)
@@ -11,7 +11,8 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.deltacloud.core;x-friends:="org.jboss.tools.deltacloud.ui",
- org.jboss.tools.deltacloud.core.client
+ org.jboss.tools.deltacloud.core.client,
+ org.apache.http.client.methods;x-friends:="org.jboss.tools.deltacloud.test"
Bundle-ClassPath: .,
lib/apache-mime4j-0.6.jar,
lib/commons-codec-1.3.jar,
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-10-21 13:39:41 UTC (rev 25970)
@@ -20,6 +20,7 @@
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -54,23 +55,43 @@
private static final String DOCUMENT_ELEMENT_DRIVER = "driver"; //$NON-NLS-1$
private static final String DOCUMENT_ELEMENT_API = "api"; //$NON-NLS-1$
+ private static final int HTTP_STATUSCODE_SERVERERROR = 500;
+ private static final int HTTP_STATUSCODE_CLIENTERROR = 400;
+ public static Logger logger = Logger.getLogger(DeltaCloudClient.class);
+
public static enum DeltaCloudType {
UNKNOWN, MOCK, EC2
}
- public static Logger logger = Logger.getLogger(DeltaCloudClient.class);
-
private static enum DCNS {
- API, INSTANCES, REALMS, IMAGES, HARDWARE_PROFILES, KEYS, START, STOP, REBOOT, DESTROY;
+ TYPE {
+ public String getResourceName() {
+ return "";
+ }
+ }
+ ,
+ INSTANCES
+ , REALMS
+ , IMAGES
+ , HARDWARE_PROFILES
+ , KEYS
+ , START
+ , STOP
+ , REBOOT
+ , DESTROY;
@Override
public String toString() {
- return "/" + name().toLowerCase();
+ return "/api/" + getResourceName();
}
+
+ public String getResourceName() {
+ return name().toLowerCase();
+ }
}
- private static enum RequestType {
+ protected static enum RequestType {
POST, GET, DELETE
};
@@ -96,48 +117,93 @@
}
private String sendRequest(String path, RequestType requestType) throws DeltaCloudClientException {
- DefaultHttpClient httpClient = new DefaultHttpClient();
- if (username != null && password != null) {
- httpClient.getCredentialsProvider().setCredentials(
- new AuthScope(baseUrl.getHost(), baseUrl.getPort()),
- new UsernamePasswordCredentials(username, password));
- }
-
+ DefaultHttpClient httpClient = addCredentials(new DefaultHttpClient());
String requestUrl = baseUrl.toString() + path;
logger.debug("Sending Request to: " + requestUrl);
try {
- HttpUriRequest request = null;
- if (requestType == RequestType.POST) {
- request = new HttpPost(requestUrl);
- } else if (requestType == RequestType.DELETE) {
- request = new HttpDelete(requestUrl);
- } else {
- request = new HttpGet(requestUrl);
- }
-
- request.setHeader("Accept", "application/xml");
+ HttpUriRequest request = getRequest(requestType, requestUrl);
+ request.setHeader("Accept", "application/xml;q=1");
HttpResponse httpResponse = httpClient.execute(request);
-
- HttpEntity entity = httpResponse.getEntity();
-
- if (entity != null) {
- InputStream is = entity.getContent();
- String xml = readInputStreamToString(is);
- httpClient.getConnectionManager().shutdown();
-
- logger.debug("Response\n" + xml);
- return xml;
+ if (isHttpError(httpResponse.getStatusLine().getStatusCode())) {
+ throw new DeltaCloudClientException(
+ MessageFormat.format("the server reported an error \"{0}\" on requesting \"{1}\"",
+ httpResponse.getStatusLine().getReasonPhrase(),requestUrl));
}
+ return getResponse(httpResponse.getEntity());
+ } catch (DeltaCloudClientException e) {
+ throw e;
} catch (IOException e) {
logger.error("Error processing request to: " + requestUrl, e);
throw new DeltaCloudClientException("Error processing request to: " + requestUrl, e);
} catch (Exception e) {
throw new DeltaCloudClientException(e.getMessage());
+ } finally {
+ httpClient.getConnectionManager().shutdown();
}
- throw new DeltaCloudClientException("Could not execute request to:" + requestUrl);
}
+ private String getResponse(HttpEntity entity) throws IOException,
+ DeltaCloudClientException {
+ if (entity == null) {
+ return null;
+ }
+ String xml = readInputStreamToString(entity.getContent());
+ logger.debug("Response\n" + xml);
+ return xml;
+ }
+
+ private boolean isHttpError(int statusCode) throws DeltaCloudClientException {
+ return isHttpServerError(statusCode)
+ || isHttpClientError(statusCode);
+ }
+
+ private boolean isHttpClientError(int statusCode) {
+ return (statusCode - HTTP_STATUSCODE_CLIENTERROR) > 0
+ && (statusCode - HTTP_STATUSCODE_CLIENTERROR) < 100;
+ }
+
+ private boolean isHttpServerError(int statusCode) {
+ return (statusCode - HTTP_STATUSCODE_SERVERERROR) > 0
+ && (statusCode - HTTP_STATUSCODE_SERVERERROR) < 100;
+ }
+
+ /**
+ * Returns a request instance for the given request type and url.
+ *
+ * @param requestType
+ * the request type to use
+ * @param requestUrl
+ * the requested url
+ * @return the request instance
+ */
+ protected HttpUriRequest getRequest(RequestType requestType, String requestUrl) {
+ switch (requestType) {
+ case POST:
+ return new HttpPost(requestUrl);
+ case DELETE:
+ return new HttpDelete(requestUrl);
+ default:
+ return new HttpGet(requestUrl);
+ }
+ }
+
+ /**
+ * Adds the credentials to the given http client.
+ *
+ * @param httpClient
+ * the http client
+ * @return the default http client
+ */
+ private DefaultHttpClient addCredentials(DefaultHttpClient httpClient) {
+ if (username != null && password != null) {
+ httpClient.getCredentialsProvider().setCredentials(
+ new AuthScope(baseUrl.getHost(), baseUrl.getPort()),
+ new UsernamePasswordCredentials(username, password));
+ }
+ return httpClient;
+ }
+
private static String readInputStreamToString(InputStream is) throws DeltaCloudClientException {
try {
try {
@@ -164,7 +230,7 @@
DeltaCloudType serverType = DeltaCloudType.UNKNOWN;
try {
String query = "?format=xml";
- String apiResponse = sendRequest(DCNS.API + query, RequestType.GET);
+ String apiResponse = sendRequest(DCNS.TYPE + query, RequestType.GET);
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = db.parse(new InputSource(new StringReader(apiResponse)));
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/ChangeLog 2010-10-21 13:39:41 UTC (rev 25970)
@@ -1,3 +1,8 @@
+2010-10-21 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
+ [JBIDE-7371] (reports404OnUnknownResource): added test for reporting 404 on bad requests
+
2010-10-20 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java:
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java 2010-10-21 13:10:42 UTC (rev 25969)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java 2010-10-21 13:39:41 UTC (rev 25970)
@@ -1,54 +0,0 @@
-package org.jboss.tools.internal.deltacloud.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.internal.deltacloud.test.fakes.ServerFake;
-import org.junit.Before;
-import org.junit.Test;
-
-public class DeltaCloudClientTest {
-
- private static final String DELTACLOUD_URL = "http://localhost:3001";
- private static final String SERVERFAKE_URL = "http://localhost:3002";
- private static final String DELTACLOUD_USER = "user";
- private static final String DELTACLOUD_PASSWORD = "password";
-
- private DeltaCloudClient client;
- private DeltaCloudClient fakeServerClient;
-
- @Before
- public void createDeltaCloudClient() throws MalformedURLException {
- this.client = new DeltaCloudClient(new URL(DELTACLOUD_URL), DELTACLOUD_USER, DELTACLOUD_PASSWORD);
- this.fakeServerClient = new DeltaCloudClient(new URL(SERVERFAKE_URL), DELTACLOUD_USER, DELTACLOUD_PASSWORD);
- }
-
- @Test
- public void isDeltaCloudRunning() throws MalformedURLException, IOException {
- URLConnection connection = new URL(DELTACLOUD_URL).openConnection();
- connection.connect();
- }
-
- @Test
- public void canRecognizeMockDeltaCloud() throws IOException {
- assertEquals(DeltaCloudClient.DeltaCloudType.MOCK, new DeltaCloudClient(DELTACLOUD_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD).getServerType());
- }
-
- @Test
- public void reportsUnknownUrl() throws IOException {
- ServerFake serverFake = new ServerFake(new URL(SERVERFAKE_URL).getPort(), "<dummy></dummy>");
- serverFake.start();
- try {
- assertEquals(DeltaCloudClient.DeltaCloudType.UNKNOWN, new DeltaCloudClient(SERVERFAKE_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD).getServerType());
- } finally {
- serverFake.stop();
- }
- }
-}
Copied: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java (from rev 25954, trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudClientTest.java)
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java (rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java 2010-10-21 13:39:41 UTC (rev 25970)
@@ -0,0 +1,84 @@
+package org.jboss.tools.internal.deltacloud.test;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.jboss.tools.internal.deltacloud.test.fakes.ServerFake;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DeltaCloudMockClientIntegrationTest {
+
+ private static final String DELTACLOUD_URL = "http://localhost:3001";
+ private static final String SERVERFAKE_URL = "http://localhost:3002";
+ private static final String DELTACLOUD_USER = "mockuser";
+ private static final String DELTACLOUD_PASSWORD = "mockpassword";
+
+ private DeltaCloudClient client;
+
+ @Before
+ public void createClient() throws IOException {
+ assertTrue(isDeltaCloudRunning());
+ client = new DeltaCloudClient(DELTACLOUD_URL, DELTACLOUD_USER, DELTACLOUD_PASSWORD);
+ }
+
+ public boolean isDeltaCloudRunning() throws IOException {
+ URLConnection connection = new URL(DELTACLOUD_URL).openConnection();
+ connection.connect();
+ return true;
+ }
+
+ @Test
+ public void canRecognizeMockDeltaCloud() throws IOException {
+ assertEquals(DeltaCloudClient.DeltaCloudType.MOCK, client.getServerType());
+ }
+
+ @Test
+ public void reportsUnknownUrl() throws IOException {
+ ServerFake serverFake = new ServerFake(new URL(SERVERFAKE_URL).getPort(), "<dummy></dummy>");
+ serverFake.start();
+ try {
+ assertEquals(DeltaCloudClient.DeltaCloudType.UNKNOWN, new DeltaCloudClient(SERVERFAKE_URL, DELTACLOUD_USER,
+ DELTACLOUD_PASSWORD).getServerType());
+ } finally {
+ serverFake.stop();
+ }
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void notAuthenticatedCannotListImages() throws MalformedURLException, DeltaCloudClientException {
+ DeltaCloudClient client = new DeltaCloudClient(DELTACLOUD_URL, "badUser", "badPassword");
+ client.listImages();
+ }
+
+ @Test
+ public void reports404OnUnknownResource() {
+ try {
+ DeltaCloudClient errorClient = new DeltaCloudClient(DELTACLOUD_URL) {
+ @Override
+ protected HttpUriRequest getRequest(RequestType requestType, String requestUrl) {
+ return new HttpGet(DELTACLOUD_URL + "/DUMMY");
+ }
+ };
+ errorClient.listImages();
+ } catch (Exception e) {
+ assertEquals(DeltaCloudClientException.class, e.getClass());
+ }
+ fail("no exception catched");
+ }
+
+ @Test
+ public void canListImages() throws DeltaCloudClientException {
+ client.listImages();
+ }
+}
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudMockClientIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 2 months
JBoss Tools SVN: r25969 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-10-21 09:10:42 -0400 (Thu, 21 Oct 2010)
New Revision: 25969
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
Log:
https://jira.jboss.org/browse/JBIDE-7312
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-21 13:08:21 UTC (rev 25968)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-21 13:10:42 UTC (rev 25969)
@@ -129,7 +129,7 @@
protected abstract IContainer getViewFolder(IProject project);
private void scanForJava(IContainer container){
- if(container.getName().startsWith("."))
+ if(container.getName().startsWith(".")) //$NON-NLS-1$
return;
try{
@@ -145,7 +145,7 @@
}
private void scan(IContainer container){
- if(container.getName().startsWith("."))
+ if(container.getName().startsWith(".")) //$NON-NLS-1$
return;
try{
14 years, 2 months
JBoss Tools SVN: r25968 - in trunk: tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-10-21 09:08:21 -0400 (Thu, 21 Oct 2010)
New Revision: 25968
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7312
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2010-10-21 12:53:18 UTC (rev 25967)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2010-10-21 13:08:21 UTC (rev 25968)
@@ -42,6 +42,16 @@
structure.addTextChange(change);
list.add(structure);
+ structure = new TestChangeStructure(project, "/WebContent/pages/el.jsp");
+ change = new TestTextChange(83, 8, "customer");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ structure = new TestChangeStructure(project, "/WebContent/testElRevalidation.xhtml");
+ change = new TestTextChange(601, 8, "customer");
+ structure.addTextChange(change);
+ list.add(structure);
+
IFile sourceFile = project.getProject().getFile("/WebContent/pages/hello.jsp");
RenameELVariableProcessor processor = new RenameELVariableProcessor(sourceFile, "user");
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2010-10-21 12:53:18 UTC (rev 25967)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2010-10-21 13:08:21 UTC (rev 25968)
@@ -14,6 +14,8 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
@@ -22,7 +24,6 @@
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.test.util.JobUtils;
public class AbstractRefactorTest extends TestCase{
@@ -38,8 +39,25 @@
checkBeforeRefactoring(changeList);
// Rename
- processor.checkInitialConditions(new NullProgressMonitor());
- processor.checkFinalConditions(new NullProgressMonitor(), null);
+ RefactoringStatus status = processor.checkInitialConditions(new NullProgressMonitor());
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ status = processor.checkFinalConditions(new NullProgressMonitor(), null);
+
+ entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+
CompositeChange rootChange = (CompositeChange)processor.createChange(new NullProgressMonitor());
checkChanges(rootChange, changeList);
@@ -53,9 +71,19 @@
// Move
MoveArguments arguments = new MoveArguments(destinationObject, true);
- participant.initialize(processor, oldObject, arguments);
- participant.checkConditions(new NullProgressMonitor(), null);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Move processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
Change mainChange = processor.createChange(new NullProgressMonitor());
@@ -72,9 +100,19 @@
// Rename
RenameArguments arguments = new RenameArguments(newName, true);
- participant.initialize(processor, oldObject, arguments);
- participant.checkConditions(new NullProgressMonitor(), null);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
Change mainChange = processor.createChange(new NullProgressMonitor());
@@ -109,6 +147,8 @@
MultiTextEdit edit = (MultiTextEdit)fileChange.getEdit();
+ //System.out.println("File - "+fileChange.getFile().getFullPath()+" offset - "+edit.getOffset());
+
TestChangeStructure change = findChange(changeList, fileChange.getFile());
if(change != null){
assertEquals(change.size(), edit.getChildrenSize());
14 years, 2 months
JBoss Tools SVN: r25967 - trunk/vpe/plugins/org.jboss.tools.vpe.docbook.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-10-21 08:53:18 -0400 (Thu, 21 Oct 2010)
New Revision: 25967
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/build.properties
Log:
fix for ClassNotFoundException for --> DocbookCautionTemplate, DocbookXrefTemplate, DocbookWarningTemplate, DocbookImportantTemplate, DocbookTipTemplate, DocbookNoteTemplate, DocbookProgramlistingTemplate (https://jira.jboss.org/browse/JBIDE-7376)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.docbook/build.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.docbook/build.properties 2010-10-21 12:29:48 UTC (rev 25966)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.docbook/build.properties 2010-10-21 12:53:18 UTC (rev 25967)
@@ -1,4 +1,7 @@
+source.. = src/
+output.. = bin/
bin.includes = META-INF/,\
+ .,\
plugin.xml,\
templates/,\
plugin.properties,\
14 years, 2 months
JBoss Tools SVN: r25966 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-10-21 08:29:48 -0400 (Thu, 21 Oct 2010)
New Revision: 25966
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
Log:
https://jira.jboss.org/browse/JBIDE-7312
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-21 11:37:50 UTC (rev 25965)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-21 12:29:48 UTC (rev 25966)
@@ -129,6 +129,9 @@
protected abstract IContainer getViewFolder(IProject project);
private void scanForJava(IContainer container){
+ if(container.getName().startsWith("."))
+ return;
+
try{
for(IResource resource : container.members()){
if(resource instanceof IFolder)
@@ -142,6 +145,9 @@
}
private void scan(IContainer container){
+ if(container.getName().startsWith("."))
+ return;
+
try{
for(IResource resource : container.members()){
if(resource instanceof IFolder)
14 years, 2 months
JBoss Tools SVN: r25965 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-10-21 07:37:50 -0400 (Thu, 21 Oct 2010)
New Revision: 25965
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
Log:
https://jira.jboss.org/browse/JBIDE-7377 Exception in error log after several files deletion -> ResourceException: Resource 'xxx' does not exist. Fixed.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-10-21 11:18:46 UTC (rev 25964)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-10-21 11:37:50 UTC (rev 25965)
@@ -101,7 +101,9 @@
private void removeMarkers(Set<IFile> files) {
try {
for (IFile file : files) {
- file.deleteMarkers(IValidator.KB_PROBLEM_MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ if(file.isAccessible()) {
+ file.deleteMarkers(IValidator.KB_PROBLEM_MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ }
}
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
14 years, 2 months
JBoss Tools SVN: r25964 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: config/requirement and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2010-10-21 07:18:46 -0400 (Thu, 21 Oct 2010)
New Revision: 25964
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddJBPM.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Executive code for Adding jBPM runtime via SWTBot tests added
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-10-21 11:14:54 UTC (rev 25963)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-10-21 11:18:46 UTC (rev 25964)
@@ -507,14 +507,68 @@
}
}
- public void addJBPMRuntime(String name, String version, String runtimeHome) {
- // TODO - needs to be impl.
- log.info("WARN - Adding JBPM Runtime, needs to be impl.");
+ /**
+ * Adds jBPM runtime via SWTBot
+ * @param name
+ * @param runtimeHome
+ */
+ public void addJBPMRuntime(String name, String runtimeHome) {
+ SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossjBPMRuntimeLocations.LABEL);
+
+ boolean createRuntime = true;
+ // first check if Environment doesn't exist
+ SWTBotTable tbRuntimeEnvironments = bot.table();
+ int numRows = tbRuntimeEnvironments.rowCount();
+ if (numRows > 0) {
+ int currentRow = 0;
+ while (createRuntime && currentRow < numRows) {
+ if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase(
+ name)) {
+ createRuntime = false;
+ } else {
+ currentRow++;
+ }
+ }
+ }
+ if (createRuntime) {
+ wiz.button("Add...").click();
+ log.info("jBPM Runtime '" + name +"' added.");
+
+ bot.shell(IDELabel.Shell.NEW_JBPM_RUNTIME).activate();
+ bot.text(0).setText(name);
+ bot.text(1).setText(runtimeHome);
+ bot.clickButton(IDELabel.Button.OK);
+
+ }
+ open.finish(wiz, IDELabel.Button.OK);
}
+ /**
+ * Removes jBPM Runtime via SWTBot
+ * @param name
+ */
public void removeJBPMRuntime(String name) {
- // TODO - needs to be impl
- log.info("WARN - Removing JBPM Runtime, needs to be impl.");
+ SWTBot wiz = open.preferenceOpen(ActionItem.Preference.JBossjBPMRuntimeLocations.LABEL);
+ SWTBotTable tbRuntimeEnvironments = bot.table();
+ int numRows = tbRuntimeEnvironments.rowCount();
+ if (numRows > 0) {
+ int currentRow = 0;
+ while (currentRow < numRows) {
+ if (tbRuntimeEnvironments.cell(currentRow, 1).equalsIgnoreCase(
+ name)) {
+ tbRuntimeEnvironments.click(currentRow, 1);
+ wiz.button(IDELabel.Button.REMOVE).click();
+ SWTBotShell shell = bot.shell("Confirm Runtime Delete");
+ shell.activate();
+ shell.bot().button(IDELabel.Button.OK).click();
+ log.info("jBPM Runtime '" + name +"' removed.");
+ break;
+ } else {
+ currentRow++;
+ }
+ }
+ }
+ open.finish(wiz,IDELabel.Button.OK);
}
public void addESBRuntime(String name, String version, String runtimeHome ) {
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddJBPM.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddJBPM.java 2010-10-21 11:14:54 UTC (rev 25963)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddJBPM.java 2010-10-21 11:18:46 UTC (rev 25964)
@@ -13,7 +13,7 @@
@Override
public void handle() {
String jbpmName = "JBPM-"+TestConfigurator.currentConfig.getJBPM().version;
- SWTTestExt.eclipse.addJBPMRuntime(jbpmName, TestConfigurator.currentConfig.getJBPM().version, TestConfigurator.currentConfig.getJBPM().jbpmHome);
+ SWTTestExt.eclipse.addJBPMRuntime(jbpmName, TestConfigurator.currentConfig.getJBPM().jbpmHome);
SWTTestExt.configuredState.getJBPM().isConfigured=true;
SWTTestExt.configuredState.getJBPM().name=jbpmName;
SWTTestExt.configuredState.getJBPM().version=TestConfigurator.currentConfig.getJBPM().version;
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-10-21 11:14:54 UTC (rev 25963)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-10-21 11:18:46 UTC (rev 25964)
@@ -137,6 +137,7 @@
public static final String CONFIRM_PERSPECTIVE_SWITCH = "Confirm Perspective Switch";
public static final String NEW_SEAM_RUNTIME = "New Seam Runtime";
public static final String NEW_ESB_RUNTIME = "New JBoss ESB Runtime";
+ public static final String NEW_JBPM_RUNTIME = "Add Location";
public static final String CONFIRM_DELETE = "Confirm Delete";
public static final String SHOW_VIEW = "Show View";
public static final String PROPERTIES_FOR = "Properties for";
14 years, 2 months
JBoss Tools SVN: r25963 - in trunk/seam/tests/org.jboss.tools.seam.xml.test: src/org/jboss/tools/seam/xml/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-21 07:14:54 -0400 (Thu, 21 Oct 2010)
New Revision: 25963
Modified:
trunk/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml
trunk/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java
Log:
JBIDE-7362
https://jira.jboss.org/browse/JBIDE-7362
Modified: trunk/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml 2010-10-21 10:03:54 UTC (rev 25962)
+++ trunk/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml 2010-10-21 11:14:54 UTC (rev 25963)
@@ -17,4 +17,7 @@
</navigation:resources>
</navigation:pages>
<pdf:document-store name="mypdfStore"/>
+ <core:init debug="#{debug}" jndi-pattern="i2"/>
+ <core:init debug="@debug" name="org.jboss.seam.core.init1"/>
+ <core:init debug="@debug@" name="org.jboss.seam.core.init2"/>
</components>
Modified: trunk/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java 2010-10-21 10:03:54 UTC (rev 25962)
+++ trunk/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java 2010-10-21 11:14:54 UTC (rev 25963)
@@ -17,8 +17,10 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.markers.XMarkerManager;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.xml.components.model.SeamComponentConstants;
+import org.jboss.tools.test.util.JobUtils;
public class SeamXMLModelTest extends TestCase {
IProject project = null;
@@ -100,6 +102,26 @@
assertAttribute(navigationPages, "https-port", "1112");
}
+ public void testDebugAttribute() { //JBIDE-7362
+ XModelObject fileObject = getComponents22Object();
+ JobUtils.waitForIdle();
+ XMarkerManager.getInstance();
+ assertNotNull("Cannot create XModel object for file components22.xml.", fileObject);
+
+ XModelObject coreInit0 = fileObject.getChildByPath("org.jboss.seam.core.init");
+ assertNotNull("Cannot find component org.jboss.seam.core.init.", coreInit0);
+ assertFalse("Validator found wrong errors in component org.jboss.seam.core.init", XMarkerManager.getInstance().hasErrors(coreInit0));
+
+ XModelObject coreInit1 = fileObject.getChildByPath("org.jboss.seam.core.init1");
+ assertNotNull("Cannot find component org.jboss.seam.core.init1.", coreInit1);
+ assertTrue("Validator failed to report an error in component org.jboss.seam.core.init1", XMarkerManager.getInstance().hasErrors(coreInit1));
+
+ XModelObject coreInit2 = fileObject.getChildByPath("org.jboss.seam.core.init2");
+ assertNotNull("Cannot find component org.jboss.seam.core.init2.", coreInit2);
+ assertFalse("Validator found wrong errors in component org.jboss.seam.core.init2", XMarkerManager.getInstance().hasErrors(coreInit2));
+
+ }
+
protected void assertAttribute(XModelObject object, String name, String value) {
String actual = object.getAttributeValue(name);
assertEquals("Attribute " + name + " in " + object.getPresentationString() + " is incorrect.", value, actual);
14 years, 2 months