JBoss Tools SVN: r26236 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-11-03 14:36:33 -0400 (Wed, 03 Nov 2010)
New Revision: 26236
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/VPEPropertyTester.java
Log:
@Override removed from VPEPropertyTester class
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/VPEPropertyTester.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/VPEPropertyTester.java 2010-11-03 18:19:46 UTC (rev 26235)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/VPEPropertyTester.java 2010-11-03 18:36:33 UTC (rev 26236)
@@ -20,7 +20,6 @@
*/
public class VPEPropertyTester extends PropertyTester{
- @Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
return !JspEditorPlugin.getDefault().getPreferenceStore()
13 years, 7 months
JBoss Tools SVN: r26235 - in trunk/deltacloud: plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-11-03 14:19:46 -0400 (Wed, 03 Nov 2010)
New Revision: 26235
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
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/Instance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java
Log:
[JBIDE-7484] reimplemented instance action to store the action-uri where it is reachable (and now comply to the Deltacloud API)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -11,7 +11,6 @@
package org.jboss.tools.deltacloud.core;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -70,7 +69,7 @@
public DeltaCloud(String name, String url, String username, String passwd,
String type, boolean persistent,
String imageFilterRules, String instanceFilterRules) throws MalformedURLException {
- this.client = new DeltaCloudClient(new URL(url), username, passwd); //$NON-NLS-1$
+ this.client = new DeltaCloudClient(url, username, passwd); //$NON-NLS-1$
this.url = url;
this.name = name;
this.username = username;
@@ -94,7 +93,7 @@
public void editCloud(String name, String url, String username, String passwd, String type)
throws MalformedURLException {
- this.client = new DeltaCloudClient(new URL(url + "/api"), username, passwd); //$NON-NLS-1$
+ this.client = new DeltaCloudClient(url, username, passwd); //$NON-NLS-1$
this.url = url;
this.name = name;
this.username = username;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -13,20 +13,21 @@
import java.util.List;
import org.jboss.tools.deltacloud.core.client.Instance;
+import org.jboss.tools.deltacloud.core.client.InstanceAction;
public class DeltaCloudInstance {
- public final static String PENDING = Instance.InstanceState.PENDING.toString();
- public final static String RUNNING = Instance.InstanceState.RUNNING.toString();
- public final static String STOPPED = Instance.InstanceState.STOPPED.toString();
- public final static String TERMINATED = Instance.InstanceState.TERMINATED.toString();
- public final static String BOGUS = Instance.InstanceState.BOGUS.toString();
+ public final static String PENDING = Instance.State.PENDING.toString();
+ public final static String RUNNING = Instance.State.RUNNING.toString();
+ public final static String STOPPED = Instance.State.STOPPED.toString();
+ public final static String TERMINATED = Instance.State.TERMINATED.toString();
+ public final static String BOGUS = Instance.State.BOGUS.toString();
- public final static String START = Instance.Action.START.toString();
- public final static String STOP = Instance.Action.STOP.toString();
- public final static String REBOOT = Instance.Action.REBOOT.toString();
- public final static String DESTROY = Instance.Action.DESTROY.toString();
+ public final static String START = InstanceAction.START;
+ public final static String STOP = InstanceAction.STOP;
+ public final static String REBOOT = InstanceAction.REBOOT;
+ public final static String DESTROY = InstanceAction.DESTROY;
private Instance instance;
private String givenName;
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-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -46,7 +46,6 @@
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.deltacloud.core.client.Instance.Action;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -56,9 +55,10 @@
public class DeltaCloudClient implements API {
+ private static final String BASEURL_API = "/api";
private static final String PEM_FILE_SUFFIX = "pem";
- 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 String DOCUMENT_ELEMENT_DRIVER = "driver";
+ private static final String DOCUMENT_ELEMENT_API = "api";
public static Logger logger = Logger.getLogger(DeltaCloudClient.class);
@@ -93,38 +93,30 @@
}
}
- protected static enum RequestType {
- POST, GET, DELETE
- };
-
private URL baseUrl;
private String username;
private String password;
public DeltaCloudClient(String url) throws MalformedURLException {
- this(new URL(url), null, null);
+ this(url, null, null);
}
public DeltaCloudClient(String url, String username, String password) throws MalformedURLException {
- this(new URL(url), username, password);
- }
- public DeltaCloudClient(URL url, String username, String password) {
-
logger.debug("Creating new Delta Cloud Client for Server: " + url);
- this.baseUrl = url;
+ this.baseUrl = new URL(url + BASEURL_API);
this.username = username;
this.password = password;
}
- private String sendRequest(String path, RequestType requestType) throws DeltaCloudClientException {
+ private String sendRequest(String path, HttpMethod httpMethod) throws DeltaCloudClientException {
DefaultHttpClient httpClient = addCredentials(new DefaultHttpClient());
- String requestUrl = baseUrl.toString() + "/api" + path;
+ String requestUrl = baseUrl.toString() + path;
logger.debug("Sending Request to: " + requestUrl);
try {
- HttpUriRequest request = getRequest(requestType, requestUrl);
+ HttpUriRequest request = getRequest(httpMethod, requestUrl);
HttpResponse httpResponse = httpClient.execute(request);
throwOnHttpErrors(requestUrl, httpResponse);
return getResponse(httpResponse.getEntity());
@@ -144,15 +136,14 @@
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (HttpStatusCode.OK.isStatus(statusCode)) {
return;
- }
- else if (HttpStatusCode.FORBIDDEN.isStatus(statusCode)) {
+ } else if (HttpStatusCode.FORBIDDEN.isStatus(statusCode)) {
throw new DeltaCloudAuthException(
MessageFormat.format("The server reported an authorization error \"{0}\" on requesting \"{1}\"",
httpResponse.getStatusLine().getReasonPhrase(), requestUrl));
} else if (HttpStatusCode.NOT_FOUND.isStatus(statusCode)) {
throw new DeltaCloudNotFoundException(
MessageFormat.format("The server could not find the resource \"{0}\"", requestUrl));
- } else if (HttpStatusRange.CLIENT_ERROR.isInRange(statusCode)
+ } else if (HttpStatusRange.CLIENT_ERROR.isInRange(statusCode)
|| HttpStatusRange.SERVER_ERROR.isInRange(statusCode)) {
throw new DeltaCloudClientException(
MessageFormat.format("The server reported an error \"{0}\" on requesting \"{1}\"",
@@ -173,21 +164,22 @@
/**
* Returns a request instance for the given request type and url.
*
- * @param requestType
+ * @param httpMethod
* the request type to use
* @param requestUrl
* the requested url
* @return the request instance
*/
- protected HttpUriRequest getRequest(RequestType requestType, String requestUrl) {
+ protected HttpUriRequest getRequest(HttpMethod httpMethod, String requestUrl) {
HttpUriRequest request = null;
- switch (requestType) {
+ switch (httpMethod) {
case POST:
request = new HttpPost(requestUrl);
break;
case DELETE:
request = new HttpDelete(requestUrl);
break;
+ case GET:
default:
request = new HttpGet(requestUrl);
}
@@ -237,7 +229,7 @@
DeltaCloudType serverType = DeltaCloudType.UNKNOWN;
try {
String query = "?format=xml";
- String apiResponse = sendRequest(DCNS.TYPE + query, RequestType.GET);
+ String apiResponse = sendRequest(DCNS.TYPE + query, HttpMethod.GET);
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = db.parse(new InputSource(new StringReader(apiResponse)));
@@ -259,7 +251,7 @@
@Override
public Instance createInstance(String imageId) throws DeltaCloudClientException {
String query = "?image_id=" + imageId;
- return buildInstance(sendRequest(DCNS.INSTANCES + query, RequestType.POST));
+ return buildInstance(sendRequest(DCNS.INSTANCES + query, HttpMethod.POST));
}
@Override
@@ -283,13 +275,13 @@
if (keyname != null)
query += "&keyname=" + keyname;
query += "&commit=create";
- return buildInstance(sendRequest(DCNS.INSTANCES + query, RequestType.POST));
+ return buildInstance(sendRequest(DCNS.INSTANCES + query, HttpMethod.POST));
}
@Override
public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
String request = DCNS.HARDWARE_PROFILES + "/" + profileId;
- return buildDeltaCloudObject(HardwareProfile.class, sendRequest(request, RequestType.GET));
+ return buildDeltaCloudObject(HardwareProfile.class, sendRequest(request, HttpMethod.GET));
}
@Override
@@ -304,18 +296,17 @@
@Override
public Image listImages(String imageId) throws DeltaCloudClientException {
- return JAXB.unmarshal(new StringReader(sendRequest(DCNS.IMAGES + "/" + imageId, RequestType.GET)), Image.class);
+ return JAXB.unmarshal(new StringReader(sendRequest(DCNS.IMAGES + "/" + imageId, HttpMethod.GET)), Image.class);
}
@Override
public List<Instance> listInstances() throws DeltaCloudClientException {
-
return listDeltaCloudObjects(Instance.class, DCNS.INSTANCES.toString(), "instance");
}
@Override
public Instance listInstances(String instanceId) throws DeltaCloudClientException {
- return buildInstance(sendRequest(DCNS.INSTANCES + "/" + instanceId, RequestType.GET));
+ return buildInstance(sendRequest(DCNS.INSTANCES + "/" + instanceId, HttpMethod.GET));
}
@Override
@@ -325,12 +316,13 @@
@Override
public Realm listRealms(String realmId) throws DeltaCloudClientException {
- return JAXB.unmarshal(new StringReader(sendRequest(DCNS.REALMS + "/" + realmId, RequestType.GET)), Realm.class);
+ return JAXB.unmarshal(new StringReader(sendRequest(DCNS.REALMS + "/" + realmId, HttpMethod.GET)), Realm.class);
}
/**
* Retrieves a key for a given name on the deltacloud server and stores it
- * in the file at the given path. The file gets created if the file path does not exist yet.
+ * in the file at the given path. The file gets created if the file path
+ * does not exist yet.
*
* @param keyname
* the name of the key to retrieve from the server
@@ -340,7 +332,7 @@
* the delta cloud client exception
*/
public void createKey(String keyname, String keyStoreLocation) throws DeltaCloudClientException {
- String xml = sendRequest(DCNS.KEYS + "?name=" + keyname, RequestType.POST);
+ String xml = sendRequest(DCNS.KEYS + "?name=" + keyname, HttpMethod.POST);
try {
String key = trimKey(getKey(xml));
File keyFile = createKeyFile(keyname, keyStoreLocation);
@@ -391,7 +383,7 @@
}
public void deleteKey(String keyname) throws DeltaCloudClientException {
- sendRequest(DCNS.KEYS + "/" + keyname, RequestType.DELETE);
+ sendRequest(DCNS.KEYS + "/" + keyname, HttpMethod.DELETE);
}
@Override
@@ -399,7 +391,7 @@
/**
* shouldn't that be PUT? changing resource states == PUT!
*/
- sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.REBOOT, RequestType.GET);
+ sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.REBOOT, HttpMethod.GET);
}
@Override
@@ -407,7 +399,7 @@
/**
* shouldn't that be PUT? changing resource states == PUT!
*/
- sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.STOP, RequestType.POST);
+ sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.STOP, HttpMethod.POST);
}
@Override
@@ -415,12 +407,12 @@
/**
* shouldn't that be PUT? changing resource states == PUT!
*/
- sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.START, RequestType.POST);
+ sendRequest(DCNS.INSTANCES + "/" + instanceId + DCNS.START, HttpMethod.POST);
}
@Override
public void destroyInstance(String instanceId) throws DeltaCloudClientException {
- sendRequest(DCNS.INSTANCES + "/" + instanceId, RequestType.DELETE);
+ sendRequest(DCNS.INSTANCES + "/" + instanceId, HttpMethod.DELETE);
}
private Instance buildInstance(String xml) throws DeltaCloudClientException {
@@ -437,27 +429,55 @@
instance.setRealmId(getIdFromHref(getAttributeValues(document, "realm", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
instance.setState(getElementText(document, "state").get(0)); //$NON-NLS-1$
getAuthentication(document, instance);
+ instance.setActions(createInstanceActions(instance, document));
- instance.setActions(createActions(instance, document));
-
return instance;
- // } catch (DeltaCloudClientException e) {
- // throw e;
+ } catch (DeltaCloudClientException e) {
+ throw e;
} catch (Exception e) {
DeltaCloudClientException newException = new DeltaCloudClientException(e.getLocalizedMessage());
throw newException;
}
}
- private List<Action> createActions(Instance instance, Document document) {
- ArrayList<Instance.Action> actions = new ArrayList<Instance.Action>();
- for (String s : getAttributeValues(document, "link", "rel")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- actions.add(Instance.Action.valueOf(s.toUpperCase()));
- }
+ private List<InstanceAction> createInstanceActions(Instance instance, Document document)
+ throws DeltaCloudClientException {
+ final List<InstanceAction> actions = new ArrayList<InstanceAction>();
+ forEachNode(document, "link", new INodeVisitor() {
+
+ @Override
+ public void visit(Node node) throws Exception {
+ NamedNodeMap attributes = node.getAttributes();
+ String name = getAttributeTextContent("rel", attributes, node);
+ String url = getAttributeTextContent("href", attributes, node);
+ String method = getAttributeTextContent("method", attributes, node);
+ actions.add(new InstanceAction(name, stripBaseUrl(url), method));
+ }
+ });
return actions;
}
+ private String stripBaseUrl(String url) throws DeltaCloudClientException {
+ String baseUrlString = baseUrl.toString();
+ if (url.indexOf(baseUrlString) != 0) {
+ throw new DeltaCloudClientException(MessageFormat.format(
+ "Resource at {0} is not child resource of root resource at {1}", url, baseUrl));
+ }
+
+ return url.substring(baseUrlString.length());
+ }
+
+ private String getAttributeTextContent(String attributeName, NamedNodeMap namedNodeMap, Node node)
+ throws DeltaCloudClientException {
+ Node attributeNode = namedNodeMap.getNamedItem(attributeName);
+ if (attributeNode == null) {
+ throw new DeltaCloudClientException(MessageFormat.format("Could not find attribute {0} in node {1}",
+ attributeName, node.getNodeName()));
+ }
+
+ return attributeNode.getTextContent();
+ }
+
private HardwareProfile buildHardwareProfile(String xml) throws DeltaCloudClientException {
try {
HardwareProfile profile = JAXB.unmarshal(new StringReader(xml), HardwareProfile.class);
@@ -466,8 +486,6 @@
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new InputSource(new StringReader(xml)));
- // checkForErrors(document);
-
List<Node> nodes = getPropertyNodes(document, "hardware_profile"); //$NON-NLS-1$
for (Node n : nodes) {
@@ -512,6 +530,17 @@
return null;
}
+ private void forEachNode(Document document, String tagName, INodeVisitor visitor) throws DeltaCloudClientException {
+ NodeList elements = document.getElementsByTagName(tagName);
+ for (int i = 0; i < elements.getLength(); i++) {
+ try {
+ visitor.visit(elements.item(i));
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e.getMessage());
+ }
+ }
+ }
+
private List<String> getAttributeValues(Document document, String elementName, String attributeName) {
NodeList elements = document.getElementsByTagName(elementName);
ArrayList<String> values = new ArrayList<String>();
@@ -609,7 +638,7 @@
dco.add(buildDeltaCloudObject(clazz, nodeToString(nodeList.item(i))));
}
return dco;
- } catch(DeltaCloudClientException e) {
+ } catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
throw new DeltaCloudClientException("Could not list object of type " + clazz, e);
@@ -618,7 +647,7 @@
private Document getDocument(String path) throws DeltaCloudClientException, ParserConfigurationException,
SAXException, IOException {
- InputSource is = new InputSource(new StringReader(sendRequest(path, RequestType.GET)));
+ InputSource is = new InputSource(new StringReader(sendRequest(path, HttpMethod.GET)));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(is);
@@ -636,11 +665,33 @@
}
}
- public boolean performInstanceAction(String instanceId, String action) throws DeltaCloudClientException {
+ /**
+ * Performs an action, indicated by a given action id, on a instance with a
+ * given instance id.
+ * <p>
+ * Retrieves the instance with the given id, checks for the actions that are
+ * available to it and performs the given action only if it is available. It
+ * is important to note that this method performs several REST calls to the
+ * server.
+ *
+ * @param instanceId
+ * the id of the instance to perfom the action on
+ * @param action
+ * the action id to perform
+ * @return true, if the action was performed successfully
+ * @throws DeltaCloudClientException
+ * indicates that an error occured while performing the action
+ *
+ * @see #startInstance(String)
+ * @see #shutdownInstance(String)
+ * @see #destroyInstance(String)
+ * @see #rebootInstance(String)
+ */
+ public boolean performInstanceAction(String instanceId, String actionName) throws DeltaCloudClientException {
Instance instance = listInstances(instanceId);
- if (instance.getActionNames().contains(action)) {
- String request = DCNS.INSTANCES + "/" + instanceId + "/" + action.toLowerCase();
- sendRequest(request, RequestType.POST);
+ InstanceAction action = instance.getAction(actionName);
+ if (action != null) {
+ sendRequest(action.getUrl(), action.getMethod());
return true;
}
return false;
@@ -656,4 +707,9 @@
throw new DeltaCloudClientException("Error transforming node to string", e);
}
}
+
+ private interface INodeVisitor {
+ public void visit(Node node) throws Exception;
+ }
+
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+public enum HttpMethod {
+ GET, POST, PUT, DELETE, HEAD;
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -19,10 +19,8 @@
{
private static final long serialVersionUID = 1L;
- public static enum InstanceState { RUNNING, STOPPED, PENDING, TERMINATED, BOGUS };
+ public static enum State { RUNNING, STOPPED, PENDING, TERMINATED, BOGUS };
- public static enum Action { START, STOP, REBOOT, DESTROY };
-
@XmlElement(name="owner_id")
private String ownerId;
@@ -44,9 +42,9 @@
private String keyname;
@XmlElement
- private InstanceState state;
+ private State state;
- private List<Action> actions;
+ private List<InstanceAction> actions;
@XmlElement(name="public_addresses")
private AddressList publicAddresses;
@@ -97,17 +95,17 @@
this.realmId = realmId;
}
- protected void setActions(List<Action> actions)
+ protected void setActions(List<InstanceAction> actions)
{
this.actions = actions;
}
-
+
protected void setState(String state)
{
try {
- this.state = InstanceState.valueOf(state);
+ this.state = State.valueOf(state);
} catch (Exception e) {
- this.state = InstanceState.BOGUS;
+ this.state = State.BOGUS;
}
}
@@ -168,12 +166,12 @@
return realmId;
}
- public InstanceState getState()
+ public State getState()
{
return state;
}
- public List<Action> getActions()
+ public List<InstanceAction> getActions()
{
return actions;
}
@@ -181,13 +179,26 @@
public List<String> getActionNames()
{
ArrayList<String>names = new ArrayList<String>();
- for (Action action : actions)
+ for (InstanceAction action : actions)
{
- names.add(action.name());
+ names.add(action.getName());
}
return names;
}
+ public InstanceAction getAction(String name) {
+ if (name == null) {
+ return null;
+ }
+
+ for(InstanceAction action : actions) {
+ if (name.equals(action.getName())) {
+ return action;
+ }
+ }
+ return null;
+ }
+
public List<String> getPublicAddresses()
{
return publicAddresses.getAddress();
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+/**
+ * An action that is executable on an instance
+ *
+ * @author André Dietisheim
+ * @see Instance
+ * @see DeltaCloudClient#performInstanceAction(String, String);
+ *
+ */
+public class InstanceAction {
+
+ public static final String START = "start";
+ public static final String STOP = "stop";
+ public static final String DESTROY = "destroy";
+ public static final String REBOOT = "reboot";
+
+ private String name;
+ private String url;
+ private HttpMethod method;
+
+ public InstanceAction(String name, String url, String method) {
+ this(name, url, HttpMethod.valueOf(method.toUpperCase()));
+ }
+
+ public InstanceAction(String name, String url, HttpMethod method) {
+ this.name = name;
+ this.url = url;
+ this.method = method;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public HttpMethod getMethod() {
+ return method;
+ }
+
+ @Override
+ public String toString() {
+ return "InstanceAction [name=" + name + ", url=" + url + ", method=" + method + "]";
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -13,7 +13,7 @@
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.Assert;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
+import org.jboss.tools.deltacloud.core.client.Instance.State;
import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
/**
@@ -30,7 +30,7 @@
DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
Assert.isTrue(expectedValue instanceof Boolean);
Boolean isExpectedValue = (Boolean) expectedValue;
- boolean isStopped = InstanceState.STOPPED.toString().equals(instance.getState());
+ boolean isStopped = State.STOPPED.toString().equals(instance.getState());
return isExpectedValue.equals(isStopped);
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -47,19 +47,21 @@
}
private void startInstance(CVInstanceElement cvInstance) {
- DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
- CloudViewElement element = cvInstance;
- while (!(element instanceof CVCloudElement)) {
- element = (CloudViewElement) element.getParent();
+ if (cvInstance != null) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ CloudViewElement element = cvInstance;
+ while (!(element instanceof CVCloudElement)) {
+ element = (CloudViewElement) element.getParent();
+ }
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+ DeltaCloudInstance.START,
+ CVMessages.getString(STARTING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] { instance.getName() }),
+ DeltaCloudInstance.RUNNING);
+ t.setUser(true);
+ t.schedule();
}
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
- DeltaCloudInstance.START,
- CVMessages.getString(STARTING_INSTANCE_TITLE),
- CVMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] { instance.getName() }),
- DeltaCloudInstance.RUNNING);
- t.setUser(true);
- t.schedule();
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -33,7 +33,7 @@
*/
public IStatus validate(Object value) {
if (!((value instanceof String) && ((String) value).length() > 0)) {
- return ValidationStatus.warning(errorMessage);
+ return ValidationStatus.error(errorMessage);
}
return ValidationStatus.ok();
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -68,7 +68,7 @@
*/
public class CloudConnectionPage extends WizardPage {
- private static final int CLOUDTYPE_CHECK_DELAY = 500;
+ private static final int CLOUDTYPE_CHECK_DELAY = 1000;
private static final String DESCRIPTION = "CloudConnection.desc"; //$NON-NLS-1$
private static final String TITLE = "CloudConnection.title"; //$NON-NLS-1$
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/InstanceMockIntegrationTest.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -25,12 +25,11 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.Image;
import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.Instance.Action;
import org.jboss.tools.deltacloud.core.client.Instance.State;
+import org.jboss.tools.deltacloud.core.client.InstanceAction;
import org.jboss.tools.internal.deltacloud.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -65,7 +64,7 @@
* @throws DeltaCloudClientException
* the delta cloud client exception
*/
- @Ignore
+
@Test
public void listContainsTestInstance() throws DeltaCloudClientException {
DeltaCloudClient client = testSetup.getClient();
@@ -75,7 +74,6 @@
assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
}
- @Ignore
@Test
public void listTestInstance() throws DeltaCloudClientException {
Instance instance = testSetup.getClient().listInstances(testSetup.getTestInstance().getId());
@@ -94,7 +92,6 @@
, instance);
}
- @Ignore
@Test(expected = DeltaCloudClientException.class)
public void listDestroyedInstanceThrowsException() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
@@ -114,7 +111,6 @@
assertTrue(publicAddresses.equals(instance.getPublicAddresses()));
}
- @Ignore
@Test(expected = DeltaCloudClientException.class)
public void cannotDestroyIfNotAuthenticated() throws MalformedURLException, DeltaCloudClientException {
DeltaCloudClient unauthenticatedClient = new DeltaCloudClient(MockIntegrationTestContext.DELTACLOUD_URL,
@@ -123,7 +119,6 @@
unauthenticatedClient.createInstance(image.getId());
}
- @Ignore
@Test
public void canCreateInstance() throws DeltaCloudClientException {
Instance instance = null;
@@ -143,7 +138,6 @@
testSetup.getClient().createInstance("dummy");
}
- @Ignore
@Test
public void canDestroy() throws DeltaCloudClientException {
Image image = testSetup.getFirstImage(testSetup.getClient());
@@ -152,13 +146,11 @@
assertNull(testSetup.getInstanceById(instance.getId(), testSetup.getClient()));
}
- @Ignore
@Test(expected = DeltaCloudClientException.class)
public void destroyThrowExceptionOnUnknowInstanceId() throws DeltaCloudClientException {
testSetup.getClient().destroyInstance("dummy");
}
- @Ignore
@Test
public void canShutdownInstance() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
@@ -168,7 +160,6 @@
assertEquals(State.STOPPED, testInstance.getState());
}
- @Ignore
@Test
public void canStartInstance() throws DeltaCloudClientException {
Instance testInstance = testSetup.getTestInstance();
@@ -186,9 +177,9 @@
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
if (testInstance.getState() == State.RUNNING) {
- client.performInstanceAction(testInstance.getId(), Action.STOP.toString());
+ client.performInstanceAction(testInstance.getId(), InstanceAction.STOP);
}
- assertTrue(client.performInstanceAction(testInstance.getId(), Action.START.toString()));
+ assertTrue(client.performInstanceAction(testInstance.getId(), InstanceAction.START));
testInstance = client.listInstances(testInstance.getId()); // reload!
assertEquals(State.RUNNING, testInstance.getState());
}
@@ -198,7 +189,7 @@
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
client.startInstance(testInstance.getId());
- assertFalse(client.performInstanceAction(testInstance.getId(), Action.START.toString()));
+ assertFalse(client.performInstanceAction(testInstance.getId(), InstanceAction.START));
}
@Test
@@ -207,7 +198,7 @@
DeltaCloudClient client = testSetup.getClient();
try {
client.shutdownInstance(testInstance.getId());
- assertFalse(client.performInstanceAction(testInstance.getId(), Action.STOP.toString()));
+ assertFalse(client.performInstanceAction(testInstance.getId(), InstanceAction.STOP));
} finally {
client.startInstance(testInstance.getId());
}
@@ -219,18 +210,19 @@
DeltaCloudClient client = testSetup.getClient();
testInstance = client.listInstances(testInstance.getId()); // reload
assertTrue(testInstance.getState() == State.RUNNING);
- assertFalse(client.performInstanceAction(testInstance.getId(), Action.DESTROY.toString()));
+ assertFalse(client.performInstanceAction(testInstance.getId(), InstanceAction.DESTROY));
}
@Test
- public void cannotRebootStoppedInstance() throws DeltaCloudClientException, InterruptedException, ExecutionException {
+ public void cannotRebootStoppedInstance() throws DeltaCloudClientException, InterruptedException,
+ ExecutionException {
Instance testInstance = testSetup.getTestInstance();
DeltaCloudClient client = testSetup.getClient();
try {
client.shutdownInstance(testInstance.getId());
testInstance = client.listInstances(testInstance.getId()); // reload
assertTrue(testInstance.getState() == State.STOPPED);
- assertFalse(client.performInstanceAction(testInstance.getId(), Action.REBOOT.toString()));
+ assertFalse(client.performInstanceAction(testInstance.getId(), InstanceAction.REBOOT));
} finally {
client.startInstance(testInstance.getId());
client.listInstances(testInstance.getId()); // reload
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java 2010-11-03 17:39:44 UTC (rev 26234)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java 2010-11-03 18:19:46 UTC (rev 26235)
@@ -22,6 +22,7 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundException;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.internal.deltacloud.test.context.MockIntegrationTestContext;
import org.jboss.tools.internal.deltacloud.test.fakes.ServerFake;
import org.junit.After;
@@ -85,7 +86,7 @@
try {
DeltaCloudClient errorClient = new DeltaCloudClient(MockIntegrationTestContext.DELTACLOUD_URL) {
@Override
- protected HttpUriRequest getRequest(RequestType requestType, String requestUrl) {
+ protected HttpUriRequest getRequest(HttpMethod httpMethod, String requestUrl) {
return new HttpGet(MockIntegrationTestContext.DELTACLOUD_URL + "/DUMMY");
}
};
13 years, 7 months
JBoss Tools SVN: r26234 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-11-03 13:39:44 -0400 (Wed, 03 Nov 2010)
New Revision: 26234
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java
Log:
show border for unknown tags on all opened vpe pages by clicking 'show border for unknown tags' button on toolbar (https://jira.jboss.org/browse/JBIDE-7383)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03 17:26:50 UTC (rev 26233)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03 17:39:44 UTC (rev 26234)
@@ -149,7 +149,8 @@
* CustomSashForm with new layout.
*/
IEditorReference[] openedEditors = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
for (IEditorReference openedEditor : openedEditors) {
IEditorPart editor = openedEditor.getEditor(true);
rotateEditor(editor, orientation);
@@ -157,15 +158,19 @@
}
private void rotateEditor(IEditorPart editor, String orientation) {
- if (editor instanceof JSPMultiPageEditor) {
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
- VpeController vpeController = (VpeController) jspEditor
- .getVisualEditor().getController();
- // if called in initialization time, vpe controller is null
- // added by Maksim Areshkau
- if (vpeController != null)
- vpeController.getPageContext().getEditPart()
- .fillContainer(true, orientation);
+
+ if (!(editor instanceof JSPMultiPageEditor)) {
+ return;
}
+
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
+ VpeController vpeController = (VpeController) jspEditor
+ .getVisualEditor().getController();
+ // if called in initialization time, vpe controller is null
+ // added by Maksim Areshkau
+ if (vpeController != null)
+ vpeController.getPageContext().getEditPart()
+ .fillContainer(true, orientation);
+
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java 2010-11-03 17:26:50 UTC (rev 26233)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java 2010-11-03 17:39:44 UTC (rev 26234)
@@ -18,6 +18,7 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -64,18 +65,28 @@
public void updateElement(UIElement element, Map parameters) {
- IEditorPart activeEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (!(activeEditor instanceof JSPMultiPageEditor)) {
+ boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS);
+
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ toggleShowBorder(editor, toggleState);
+ }
+ }
+
+ private void toggleShowBorder(IEditorPart editor, boolean toggleState) {
+
+ if (!(editor instanceof JSPMultiPageEditor)) {
return;
}
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) activeEditor;
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
VpeController vpeController = (VpeController) jspEditor
.getVisualEditor().getController();
- boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
- .getBoolean(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS);
/*
* Set new value to VpeVisualDomBuilder.
*/
13 years, 7 months
JBoss Tools SVN: r26233 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-11-03 13:26:50 -0400 (Wed, 03 Nov 2010)
New Revision: 26233
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
Log:
rotate all opened editors by clicking 'rotate editors' button on toolbar (https://jira.jboss.org/browse/JBIDE-7383)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03 17:19:40 UTC (rev 26232)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03 17:26:50 UTC (rev 26233)
@@ -23,6 +23,9 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -145,17 +148,24 @@
* Call <code>filContainer()</code> from VpeEditorPart to redraw
* CustomSashForm with new layout.
*/
- IEditorPart activeEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (activeEditor instanceof JSPMultiPageEditor) {
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) activeEditor;
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ rotateEditor(editor, orientation);
+ }
+ }
+
+ private void rotateEditor(IEditorPart editor, String orientation) {
+ if (editor instanceof JSPMultiPageEditor) {
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
VpeController vpeController = (VpeController) jspEditor
.getVisualEditor().getController();
- //if called in initialization time, vpe controller is null
- //added by Maksim Areshkau
- if(vpeController!=null)
- vpeController.getPageContext().getEditPart()
- .fillContainer(true, orientation);
+ // if called in initialization time, vpe controller is null
+ // added by Maksim Areshkau
+ if (vpeController != null)
+ vpeController.getPageContext().getEditPart()
+ .fillContainer(true, orientation);
}
}
}
13 years, 7 months
JBoss Tools SVN: r26232 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2010-11-03 13:19:40 -0400 (Wed, 03 Nov 2010)
New Revision: 26232
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7381 , SwtBotTest was updated.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-11-03 16:29:01 UTC (rev 26231)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-11-03 17:19:40 UTC (rev 26232)
@@ -354,56 +354,9 @@
}
public void testNewFileInExternalizeStringsDialog() throws Throwable {
- isUnusedDialogOpened = false;
+ SWTBotEditor editor = createNewBundleToLastPage(JBT_TEST_PROJECT_NAME
+ + "/WebContent/pages", "externalize.properties"); //$NON-NLS-1$ //$NON-NLS-2$
/*
- * Open simple html file in order to get the VPE toolbar
- */
- SWTBotEditor editor = SWTTestExt.packageExplorer.openFile(JBT_TEST_PROJECT_NAME,
- "WebContent", "pages", TEST_PAGE); //$NON-NLS-1$ //$NON-NLS-2$
- editor.setFocus();
- /*
- * Select some text
- */
- editor.toTextEditor().selectRange(7, 12, 5);
- /*
- * Get toolbar button
- */
- assertTrue(TOOLBAR_ICON_ENABLED, bot
- .toolbarButtonWithTooltip(TOOL_TIP)
- .isEnabled());
- bot.toolbarButtonWithTooltip(TOOL_TIP).click();
- bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
- bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
- isUnusedDialogOpened = true;
- /*
- * Enable next page and check it
- */
- SWTBotCheckBox checkBox = bot.checkBox();
- assertNotNull("Cannot find checkbox '" //$NON-NLS-1$
- + JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE + "'", //$NON-NLS-1$
- checkBox);
- checkBox.select();
- assertTrue("Checkbox should be checked.", //$NON-NLS-1$
- checkBox.isChecked());
- assertTrue("Next button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
- bot.button(WidgetVariables.NEXT_BUTTON).click();
- /*
- * Create new file
- */
- SWTBotText folderText = bot.textWithLabel(FOLDER_TEXT_LABEL);
- assertNotNull("'" + FOLDER_TEXT_LABEL + "' text field is not found", folderText); //$NON-NLS-1$ //$NON-NLS-2$
- folderText.setText(JBT_TEST_PROJECT_NAME+"/WebContent/pages"); //$NON-NLS-1$
- SWTBotText fileName = bot.textWithLabel("File name:"); //$NON-NLS-1$
- assertNotNull("'File Name:' text field is not found", fileName); //$NON-NLS-1$
- fileName.setText("externalize.properties"); //$NON-NLS-1$
- /*
- * 'Next>' button should be enabled. Press it.
- */
- assertTrue("(Next>) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
- bot.button(WidgetVariables.NEXT_BUTTON).click();
- /*
* 'OK' button should be enabled. Press it.
*/
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
@@ -615,7 +568,7 @@
assertNotNull(CANNOT_FIND_RADIO_BUTTON
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED,
rb);
- assertTrue("("+JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED+") " +
+ assertTrue("("+JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED+") " + //$NON-NLS-1$ //$NON-NLS-2$
"radio button should be enabled.", //$NON-NLS-1$
rb.isSelected());
/*
@@ -707,4 +660,159 @@
bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).close();
isUnusedDialogOpened = false;
}
+
+ public void testNewBundleRegisteringInFacesConfig() throws Throwable {
+ SWTBotEditor editor = createNewBundleToLastPage("", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Select 'in the faces-config.xml file' radio button
+ */
+ SWTBotRadio rb = bot.radioInGroup(
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_FACES_CONFIG,
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_SAVE_RESOURCE_BUNDLE);
+ assertNotNull(CANNOT_FIND_RADIO_BUTTON
+ + JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_FACES_CONFIG,
+ rb);
+ rb.setFocus();
+ rb.click();
+ assertTrue("("+JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_FACES_CONFIG+") " + //$NON-NLS-1$ //$NON-NLS-2$
+ "radio button should be enabled.", //$NON-NLS-1$
+ rb.isSelected());
+
+ /*
+ * 'OK' button should be enabled. Press it.
+ */
+ assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.OK_BUTTON).isEnabled());
+ bot.button(WidgetVariables.OK_BUTTON).click();
+ isUnusedDialogOpened = false;
+ /*
+ * Check that the text was replaced
+ */
+ editor.setFocus();
+ editor.toTextEditor().selectRange(7, 12, 22);
+ assertEquals("Replaced text is incorrect", "#{inputUserName.Input}", editor.toTextEditor().getSelection()); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Check that the resource-bundle has been added to the faces-config
+ */
+ SWTBotEditor ed = bot.editorByTitle("faces-config.xml"); //$NON-NLS-1$
+ assertNotNull("faces-config.xml should be opened in the editor", ed); //$NON-NLS-1$
+ ed.setFocus();
+ bot.cTabItem("Source").activate(); //$NON-NLS-1$
+
+ ed.toTextEditor().selectLine(23);
+ assertEquals("24 line in not: <resource-bundle>", //$NON-NLS-1$
+ " <resource-bundle>", //$NON-NLS-1$
+ ed.toTextEditor().getSelection());
+ ed.toTextEditor().selectLine(24);
+ assertEquals("25 line in not: <base-name>inputUserName</base-name>", //$NON-NLS-1$
+ " <base-name>inputUserName</base-name>", //$NON-NLS-1$
+ ed.toTextEditor().getSelection());
+ ed.toTextEditor().selectLine(25);
+ assertEquals("26 line in not: <var>inputUserName</var>", //$NON-NLS-1$
+ " <var>inputUserName</var>", //$NON-NLS-1$
+ ed.toTextEditor().getSelection());
+ ed.toTextEditor().selectLine(26);
+ assertEquals("27 line in not: </resource-bundle>", //$NON-NLS-1$
+ " </resource-bundle>", //$NON-NLS-1$
+ ed.toTextEditor().getSelection());
+ }
+
+ public void testNewBundleRegisteringViaLoadBundleTag() throws Throwable {
+ SWTBotEditor editor = createNewBundleToLastPage("", "inputUserName2"); //$NON-NLS-1$ //$NON-NLS-2$
+ /*
+ * Select 'via <f:loadBundle> tag on the current page' radio button
+ */
+ SWTBotRadio rb = bot.radioInGroup(
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_LOAD_BUNDLE,
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_SAVE_RESOURCE_BUNDLE);
+ assertNotNull(CANNOT_FIND_RADIO_BUTTON
+ + JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_LOAD_BUNDLE,
+ rb);
+ rb.setFocus();
+ rb.click();
+ assertTrue("("+JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_LOAD_BUNDLE+") " + //$NON-NLS-1$ //$NON-NLS-2$
+ "radio button should be enabled.", //$NON-NLS-1$
+ rb.isSelected());
+
+ /*
+ * 'OK' button should be enabled. Press it.
+ */
+ assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.OK_BUTTON).isEnabled());
+ bot.button(WidgetVariables.OK_BUTTON).click();
+ isUnusedDialogOpened = false;
+ /*
+ * Check that the text was replaced
+ */
+ editor.setFocus();
+ editor.toTextEditor().selectLine(7);
+ assertEquals("Replaced text is incorrect", //$NON-NLS-1$
+ " <title><f:loadBundle var=\"inputUserName\" basename=\"inputUserName2\" />#{inputUserName.Input} User Name Page</title>", //$NON-NLS-1$
+ editor.toTextEditor().getSelection());
+ }
+
+ /**
+ * Creates the new bundle till last page.
+ *
+ * @param folderPath the folder path
+ * @param fileName the file name
+ * @return the swt bot editor
+ */
+ private SWTBotEditor createNewBundleToLastPage(String folderPath, String fileName) {
+ isUnusedDialogOpened = false;
+ /*
+ * Open simple html file in order to get the VPE toolbar
+ */
+ SWTBotEditor editor = SWTTestExt.packageExplorer.openFile(JBT_TEST_PROJECT_NAME,
+ "WebContent", "pages", TEST_PAGE); //$NON-NLS-1$ //$NON-NLS-2$
+ editor.setFocus();
+ /*
+ * Select some text
+ */
+ editor.toTextEditor().selectRange(7, 12, 5);
+ /*
+ * Get toolbar button
+ */
+ assertTrue(TOOLBAR_ICON_ENABLED, bot
+ .toolbarButtonWithTooltip(TOOL_TIP)
+ .isEnabled());
+ bot.toolbarButtonWithTooltip(TOOL_TIP).click();
+ bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
+ bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
+ isUnusedDialogOpened = true;
+ /*
+ * Enable next page and check it
+ */
+ SWTBotCheckBox checkBox = bot.checkBox();
+ assertNotNull("Cannot find checkbox '" //$NON-NLS-1$
+ + JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE + "'", //$NON-NLS-1$
+ checkBox);
+ checkBox.select();
+ assertTrue("Checkbox should be checked.", //$NON-NLS-1$
+ checkBox.isChecked());
+ assertTrue("Next button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ /*
+ * Create new file
+ */
+ SWTBotText folderText = bot.textWithLabel(FOLDER_TEXT_LABEL);
+ assertNotNull("'" + FOLDER_TEXT_LABEL + "' text field is not found", folderText); //$NON-NLS-1$ //$NON-NLS-2$
+ if ((null != folderPath) && (folderPath.length() > 0)){
+ folderText.setText(folderPath);
+ }
+ SWTBotText fileNameField = bot.textWithLabel("File name:"); //$NON-NLS-1$
+ assertNotNull("'File Name:' text field is not found", fileNameField); //$NON-NLS-1$
+ if ((null != fileName) && (fileName.length() > 0)) {
+ fileNameField.setText(fileName);
+ }
+ /*
+ * 'Next>' button should be enabled. Press it.
+ */
+ assertTrue("(Next>) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+
+ return editor;
+ }
}
13 years, 7 months
JBoss Tools SVN: r26231 - trunk/documentation/qa/docs/Test_Cases.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-11-03 12:29:01 -0400 (Wed, 03 Nov 2010)
New Revision: 26231
Modified:
trunk/documentation/qa/docs/Test_Cases/VPEtests.doc
Log:
Automated Tests for Editing via Visual Editor Context Menu.
Modified: trunk/documentation/qa/docs/Test_Cases/VPEtests.doc
===================================================================
(Binary files differ)
13 years, 7 months
JBoss Tools SVN: r26230 - in trunk: vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-11-03 12:26:10 -0400 (Wed, 03 Nov 2010)
New Revision: 26230
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
Log:
Added Tests for Editing via Visual Editor Context Menu.
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-11-03 15:53:12 UTC (rev 26229)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-11-03 16:26:10 UTC (rev 26230)
@@ -150,6 +150,7 @@
public static final String ADD_PALETTE_GROUP = "Add Palette Group";
public static final String ADD_PALETTE_MACRO = "Add Palette Macro";
public static final String CONFIRMATION = "Confirmation";
+ public static final String USER_SPECIFIED_TAG_TEMPLATE = "User specified tag template";
}
public class EntityGroup {
@@ -588,4 +589,10 @@
}
+ public static class UserSpecifiedTagTemplateDialog{
+
+ public static final String TAG_FOR_DISPLAY = "Tag for display:";
+
+ }
+
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java 2010-11-03 15:53:12 UTC (rev 26229)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/EditingActionsTest.java 2010-11-03 16:26:10 UTC (rev 26230)
@@ -13,10 +13,17 @@
import java.awt.event.KeyEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
import org.mozilla.interfaces.nsIDOMNode;
/**
@@ -41,7 +48,7 @@
private static final String TEST_PAGE_NAME = "EditingActionsTest.jsp";
- private SWTBotEclipseEditor jspTextEditor;
+ private SWTBotEclipseEditor jspEditor;
private SWTBotWebBrowser webBrowser;
public EditingActionsTest() {
@@ -53,12 +60,12 @@
super.setUp();
eclipse.maximizeActiveShell();
createJspPage(EditingActionsTest.TEST_PAGE_NAME);
- jspTextEditor = botExt.editorByTitle(EditingActionsTest.TEST_PAGE_NAME).toTextEditor();
+ jspEditor = botExt.editorByTitle(EditingActionsTest.TEST_PAGE_NAME).toTextEditor();
webBrowser = new SWTBotWebBrowser(EditingActionsTest.TEST_PAGE_NAME,botExt);
}
/**
- * Insert Tag After Selected Tag
+ * Tests Cut Copy Paste Operations
*/
public void testCutCopyPasteUndo(){
@@ -66,17 +73,17 @@
// Check Copy Functionality
webBrowser.clickContextMenu(node,
SWTBotWebBrowser.COPY_MENU_LABEL);
- jspTextEditor.setFocus();
- jspTextEditor.selectRange(4,18,1);
- jspTextEditor.insertText(4,18,"");
+ jspEditor.setFocus();
+ jspEditor.selectRange(4,18,1);
+ jspEditor.insertText(4,18,"");
webBrowser.clickContextMenu(node,
SWTBotWebBrowser.PASTE_MENU_LABEL);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<h:inputText/><h:inputText/><h:outputTextvalue=\"outputText\"/><h:inputText/>",
EditingActionsTest.TEST_PAGE);
- assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 6, EditingActionsTest.TEST_PAGE);
+ assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 6, EditingActionsTest.TEST_PAGE_NAME);
assertProbelmsViewNoErrors(botExt);
// Check Cut Functionality
node = webBrowser.getDomNodeByTagName("INPUT",0);
@@ -84,65 +91,65 @@
botExt.sleep(Timing.time1S());
webBrowser.clickContextMenu(node,
SWTBotWebBrowser.CUT_MENU_LABEL);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<body><h:inputText/><h:outputTextvalue=\"outputText\"/><h:inputText/><rich:comboBox>",
- EditingActionsTest.TEST_PAGE);
- assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 5, EditingActionsTest.TEST_PAGE);
+ EditingActionsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 5, EditingActionsTest.TEST_PAGE_NAME);
assertProbelmsViewNoErrors(botExt);
// Check Paste Functionality
node = webBrowser.getDomNodeByTagName("INPUT",1);
- jspTextEditor.setFocus();
- jspTextEditor.selectRange(6,18,1);
- jspTextEditor.insertText(6,18,"");
+ jspEditor.setFocus();
+ jspEditor.selectRange(6,18,1);
+ jspEditor.insertText(6,18,"");
webBrowser.clickContextMenu(node,
SWTBotWebBrowser.PASTE_MENU_LABEL);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<h:inputText/><h:outputTextvalue=\"outputText\"/><h:inputText/><h:inputText/>",
- EditingActionsTest.TEST_PAGE);
- assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 6, EditingActionsTest.TEST_PAGE);
+ EditingActionsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 6, EditingActionsTest.TEST_PAGE_NAME);
assertProbelmsViewNoErrors(botExt);
// Check Undo Functionality
webBrowser.setFocus();
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_Z, KeyEvent.VK_CONTROL);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<h:outputTextvalue=\"outputText\"/><h:inputText/><rich:comboBox>",
- EditingActionsTest.TEST_PAGE);
+ EditingActionsTest.TEST_PAGE_NAME);
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_Z, KeyEvent.VK_CONTROL);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<h:inputText/><h:inputText/><h:outputTextvalue=\"outputText\"/>",
- EditingActionsTest.TEST_PAGE);KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_Z, KeyEvent.VK_CONTROL);
- jspTextEditor.save();
+ EditingActionsTest.TEST_PAGE_NAME);KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_Z, KeyEvent.VK_CONTROL);
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<body><h:inputText/><h:outputTextvalue=\"outputText\"/>",
- EditingActionsTest.TEST_PAGE);
+ EditingActionsTest.TEST_PAGE_NAME);
// Check Delete Functionality
webBrowser.setFocus();
webBrowser.selectDomNode(webBrowser.getDomNodeByTagName("INPUT",2),0);
botExt.sleep(Timing.time1S());
KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_DELETE);
- jspTextEditor.save();
+ jspEditor.save();
botExt.sleep(Timing.time3S());
- assertSourceEditorContains(stripHTMLSourceText(jspTextEditor.getText()),
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
"<body><h:inputText/><h:outputTextvalue=\"outputText\"/><h:inputText/></body>",
- EditingActionsTest.TEST_PAGE);
- assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 2, EditingActionsTest.TEST_PAGE);
+ EditingActionsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 2, EditingActionsTest.TEST_PAGE_NAME);
}
/**
* Inits JSP Page before Tag will be inserted
*/
private nsIDOMNode initJspPageBeforeInserting(String pageText , String nodeText) {
- jspTextEditor.setText(pageText);
- jspTextEditor.save();
+ jspEditor.setText(pageText);
+ jspEditor.save();
botExt.sleep(Timing.time3S());
nsIDOMNode node = webBrowser.getDomNodeByTagName(nodeText, 0);
webBrowser.selectDomNode(node, 0);
@@ -151,7 +158,187 @@
return node;
}
+ /**
+ * Check Replace with Functionality
+ */
+ public void testReplaceWith(){
+ nsIDOMNode node = initJspPageBeforeInserting("<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\" %>\n" +
+ "<html>\n" +
+ " <body>\n" +
+ " <h:inputText/>\n" +
+ " </body>\n" +
+ "</html>",
+ "INPUT");
+ webBrowser.clickContextMenu(node,
+ SWTBotWebBrowser.REPLACE_WITH_MENU_LABEL,
+ SWTBotWebBrowser.JSF_MENU_LABEL,
+ SWTBotWebBrowser.HTML_MENU_LABEL,
+ SWTBotWebBrowser.H_OUTPUT_TEXT_TAG_MENU_LABEL);
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
+ "h:outputText",
+ EditingActionsTest.TEST_PAGE_NAME);
+ assertSourceEditorNotContain(stripHTMLSourceText(jspEditor.getText()),
+ "h:inputText",
+ EditingActionsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsManyNodes(webBrowser, "SPAN", 1, EditingActionsTest.TEST_PAGE_NAME);
+ assertVisualEditorContainsManyNodes(webBrowser, "INPUT", 0, EditingActionsTest.TEST_PAGE_NAME);
+ }
+ public void testSetupTemplateFor(){
+ final String unknownTag = "h:text";
+ jspEditor.setText("<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\"%>\n" +
+ "<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\"%>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " <title>Input User Name Page</title>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <" + unknownTag + " value=\"Text to edit\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>");
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ assertVisualEditorContainsNodeWithValue(webBrowser, "h:text", EditingActionsTest.TEST_PAGE_NAME);
+ nsIDOMNode node = webBrowser.getDomNodeByTagName("DIV", 4);
+ webBrowser.selectDomNode(node, 0);
+ webBrowser.clickContextMenu(node,
+ SWTBotWebBrowser.SETUP_VISUAL_TEMPLATE_FOR_MENU_LABEL + "<" + unknownTag + ">...");
+ // Test if window for Tag Template definition was properly opened
+ WidgetNotFoundException wnfe = null;
+ try{
+ bot.shell(IDELabel.Shell.USER_SPECIFIED_TAG_TEMPLATE).activate();
+ bot.textWithLabel(IDELabel.UserSpecifiedTagTemplateDialog.TAG_FOR_DISPLAY).setText("tt");
+ bot.button(IDELabel.Button.OK).click();
+ } catch (WidgetNotFoundException wnfetmp){
+ wnfe = wnfetmp;
+ }
+ assertNull("Dialog for User Specified Tag Template does not work properly" + wnfe,wnfe);
+ }
+ /**
+ * Tests Parent Tag Menu
+ */
+ public void testParentTagMenu(){
+
+ nsIDOMNode node = initJspPageBeforeInserting("<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\"%>\n" +
+ "<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\"%>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " <title>Input User Name Page</title>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <h:inputText value=\"Text to edit\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>", "INPUT");
+ webBrowser.selectDomNode(node, 0);
+ final String parentTagFViewLabel = SWTBotWebBrowser.PARENT_TAG_MENU_LABEL + " (f:view)";
+ final Menu topMenu = webBrowser.getTopMenu(node, parentTagFViewLabel);
+
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ ContextMenuHelper.clickContextMenu(topMenu, parentTagFViewLabel);
+ // Parent Tag f:view check
+ MenuItem parentTagFViewMenuItem = ContextMenuHelper.getContextMenu(topMenu, parentTagFViewLabel, false);
+ Menu parentTagFViewMenu = ContextMenuHelper.showMenuOfMenuItem(parentTagFViewMenuItem);
+ // Parent Tag Body check
+ final String parentTagBodyLabel = SWTBotWebBrowser.PARENT_TAG_MENU_LABEL + " (body)";
+ MenuItem parentTagBodyMenuItem = ContextMenuHelper.getContextMenu(parentTagFViewMenu, parentTagBodyLabel, false);
+ Menu parentTagBodyMenu = ContextMenuHelper.showMenuOfMenuItem(parentTagBodyMenuItem);
+ // Parent Tag HTML check
+ final String parentTagHTMLLabel = SWTBotWebBrowser.PARENT_TAG_MENU_LABEL + " (html)";
+ MenuItem parentTagHTMLMenuItem = ContextMenuHelper.getContextMenu(parentTagBodyMenu, parentTagHTMLLabel, false);
+ Menu parentTagHTMLMenu = ContextMenuHelper.showMenuOfMenuItem(parentTagHTMLMenuItem);
+ // There should by no parent tag anymore
+ String[] menuItemLabels = ContextMenuHelper.getMenuItemLabels(parentTagHTMLMenu);
+ String menuItemLabelStartingWithParentTag = null;
+ int index = 0;
+ while (index < menuItemLabels.length && menuItemLabelStartingWithParentTag == null){
+ if (menuItemLabels[index].startsWith(SWTBotWebBrowser.PARENT_TAG_MENU_LABEL)){
+ menuItemLabelStartingWithParentTag = menuItemLabels[index];
+ }
+ else{
+ index++;
+ }
+ }
+ ContextMenuHelper.hideMenuNonRecursively(parentTagHTMLMenu);
+ ContextMenuHelper.hideMenuNonRecursively(parentTagBodyMenu);
+ ContextMenuHelper.hideMenuNonRecursively(parentTagFViewMenu);
+ ContextMenuHelper.hideMenuNonRecursively(topMenu);
+ assertNull("There has to be no menu item in HTML tag submenu starting with " + SWTBotWebBrowser.PARENT_TAG_MENU_LABEL +
+ "\nbut there is this one: " + menuItemLabelStartingWithParentTag,
+ menuItemLabelStartingWithParentTag);
+ }
+ });
+
+ }
+
+ /**
+ * Tests Strip Tag Menu
+ */
+ public void testStripTagMenu(){
+
+ nsIDOMNode node = initJspPageBeforeInserting("<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\"%>\n" +
+ "<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\"%>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " <title>Input User Name Page</title>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <h:inputText value=\"Text to edit\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>", "INPUT");
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ webBrowser.selectDomNode(node, 0);
+ webBrowser.clickContextMenu(node,
+ SWTBotWebBrowser.PARENT_TAG_MENU_LABEL + " (f:view)",
+ SWTBotWebBrowser.STRIP_TAG_MENU_LABEL);
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ assertSourceEditorNotContain(jspEditor.getText(), "<f:view>", EditingActionsTest.TEST_PAGE_NAME);
+ // Undo Changes
+ webBrowser.setFocus();
+ KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_Z, KeyEvent.VK_CONTROL);
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ assertSourceEditorContains(jspEditor.getText(), "<f:view>", EditingActionsTest.TEST_PAGE_NAME);
+ }
+ /**
+ * Tests Select This Tag Menu
+ */
+ public void testSelectThisTagMenu(){
+
+ nsIDOMNode node = initJspPageBeforeInserting("<%@ taglib uri=\"http://java.sun.com/jsf/core\" prefix=\"f\"%>\n" +
+ "<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\"%>\n" +
+ "<html>\n" +
+ " <head>\n" +
+ " <title>Input User Name Page</title>\n" +
+ " </head>\n" +
+ " <body>\n" +
+ " <f:view>\n" +
+ " <h:inputText value=\"Text to edit\"/>\n" +
+ " </f:view>\n" +
+ " </body>\n" +
+ "</html>", "INPUT");
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ webBrowser.selectDomNode(node, 0);
+ webBrowser.clickContextMenu(node,
+ SWTBotWebBrowser.PARENT_TAG_MENU_LABEL + " (f:view)",
+ SWTBotWebBrowser.SELECT_THIS_TAG_MENU_LABEL);
+ jspEditor.save();
+ bot.sleep(Timing.time2S());
+ assertSourceEditorContains(stripHTMLSourceText(jspEditor.getText()),
+ "<f:view><h:inputText",
+ EditingActionsTest.TEST_PAGE_NAME);
+ }
@Override
protected void closeUnuseDialogs() {
@@ -163,7 +350,7 @@
}
@Override
protected void tearDown() throws Exception {
- jspTextEditor.close();
+ jspEditor.close();
super.tearDown();
}
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2010-11-03 15:53:12 UTC (rev 26229)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2010-11-03 16:26:10 UTC (rev 26230)
@@ -104,6 +104,21 @@
}
/**
+ * Asserts if sourceEditorText of file with fileName does not contain textToNotContain
+ * @param sourceEditorText
+ * @param textToNotContain
+ * @param fileName
+ */
+ protected static void assertSourceEditorNotContain (String sourceEditorText, String textToNotContain, String fileName){
+
+ assertTrue("File " + fileName
+ + " must not contain string '"
+ + textToNotContain
+ + "' but it does.\nIt is: " + sourceEditorText,
+ !sourceEditorText.contains(textToNotContain));
+
+ }
+ /**
* Asserts if sourceEditorText of file with fileName equals to expectedText
* @param sourceEditorText
* @param expectedText
@@ -173,7 +188,7 @@
String fileName){
assertTrue("Visual Representation of file " + fileName
- + " has to contain noide with "
+ + " has to contain node with "
+ valueToContain
+ " value but it doesn't",
webBrowser.containsNodeWithValue(webBrowser.getMozillaEditor().getDomDocument(),
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2010-11-03 15:53:12 UTC (rev 26229)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2010-11-03 16:26:10 UTC (rev 26230)
@@ -85,6 +85,8 @@
public static final String CUT_MENU_LABEL = "Cut";
public static final String COPY_MENU_LABEL = "Copy";
public static final String PASTE_MENU_LABEL = "Paste";
+ public static final String SETUP_VISUAL_TEMPLATE_FOR_MENU_LABEL = "Setup Visual Template for ";
+ public static final String SELECT_THIS_TAG_MENU_LABEL = "Select This Tag";
public static final String JSF_MENU_LABEL = "JSF";
public static final String JBOSS_MENU_LABEL = "JBoss";
13 years, 7 months
JBoss Tools SVN: r26229 - trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-11-03 11:53:12 -0400 (Wed, 03 Nov 2010)
New Revision: 26229
Modified:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
Log:
JBIDE-7455
https://jira.jboss.org/browse/JBIDE-7455
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-03 14:25:55 UTC (rev 26228)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/JSFVersions.xml 2010-11-03 15:53:12 UTC (rev 26229)
@@ -17,7 +17,7 @@
<refLib type="servlet" location="../servlet" />
<projectTempl location="./jsf-1.2-facelets" />
</version>
- <version displayName="JSF 2.0" servlet-version="2.5">
+ <version displayName="JSF 2.0" servlet-version="3.0">
<lib type="core" location="../lib/jsf-1.2"/>
<lib type="common" location="../lib/ApacheCommon2.3" />
<refLib type="servlet" location="../servlet" />
13 years, 7 months
JBoss Tools SVN: r26228 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2010-11-03 10:25:55 -0400 (Wed, 03 Nov 2010)
New Revision: 26228
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7381 , SwtBotTest was updated.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-11-03 14:21:24 UTC (rev 26227)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-11-03 14:25:55 UTC (rev 26228)
@@ -16,6 +16,7 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
@@ -32,6 +33,7 @@
private final String INCORRECT_TABLE_VALUE = "Table value is incorrect"; //$NON-NLS-1$
private final String TOOLBAR_ICON_ENABLED = "Toolbar buttion should be enabled"; //$NON-NLS-1$
private final String CANNOT_FIND_PROPERTY_VALUE = "Cannot find 'Property Value' text field"; //$NON-NLS-1$
+ private final String CANNOT_FIND_RADIO_BUTTON = "Cannot find radio button with name: "; //$NON-NLS-1$
private final String COMPLEX_TEXT = "!! HELLO ~ Input User, Name.Page ?" //$NON-NLS-1$
+ " \r\n and some more text \r\n" //$NON-NLS-1$
+ "@ \\# vc \\$ % yy^ &*(ghg ) _l-kk+mmm\\/fdg\\ " //$NON-NLS-1$
@@ -395,6 +397,15 @@
SWTBotText fileName = bot.textWithLabel("File name:"); //$NON-NLS-1$
assertNotNull("'File Name:' text field is not found", fileName); //$NON-NLS-1$
fileName.setText("externalize.properties"); //$NON-NLS-1$
+ /*
+ * 'Next>' button should be enabled. Press it.
+ */
+ assertTrue("(Next>) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ /*
+ * 'OK' button should be enabled. Press it.
+ */
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
bot.button(WidgetVariables.OK_BUTTON).isEnabled());
bot.button(WidgetVariables.OK_BUTTON).click();
@@ -582,7 +593,7 @@
*/
SWTBotText folderText = bot.textWithLabel(FOLDER_TEXT_LABEL);
assertNotNull("'" + FOLDER_TEXT_LABEL + "' text field is not found", folderText); //$NON-NLS-1$ //$NON-NLS-2$
- assertText(JBT_TEST_PROJECT_NAME+"/WebContent/pages", folderText); //$NON-NLS-1$
+ assertText(JBT_TEST_PROJECT_NAME+"/JavaSource", folderText); //$NON-NLS-1$
/*
* Check the file name
*/
@@ -590,6 +601,24 @@
assertNotNull("'File Name:' text field is not found", fileName); //$NON-NLS-1$
assertText("hello.properties", fileName); //$NON-NLS-1$
/*
+ * 'Next>' button should be enabled. Press it.
+ */
+ assertTrue("(Next>) button should be enabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ /*
+ * Check that 'manually by user' radiobutton is selected
+ */
+ SWTBotRadio rb = bot.radioInGroup(
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED,
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_SAVE_RESOURCE_BUNDLE);
+ assertNotNull(CANNOT_FIND_RADIO_BUTTON
+ + JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED,
+ rb);
+ assertTrue("("+JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED+") " +
+ "radio button should be enabled.", //$NON-NLS-1$
+ rb.isSelected());
+ /*
* Create new file
*/
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
@@ -601,7 +630,7 @@
*/
editor.close();
SWTBotEditor editor2 = SWTTestExt.eclipse.openFile(
- JBT_TEST_PROJECT_NAME, "WebContent", "pages", //$NON-NLS-1$ //$NON-NLS-2$
+ JBT_TEST_PROJECT_NAME, "JavaSource", //$NON-NLS-1$
"hello.properties"); //$NON-NLS-1$
editor2.toTextEditor().selectLine(0);
String line = editor2.toTextEditor().getSelection();
@@ -658,7 +687,7 @@
*/
folderText = bot.textWithLabel(FOLDER_TEXT_LABEL);
assertNotNull("'" + FOLDER_TEXT_LABEL + "' text field is not found", folderText); //$NON-NLS-1$ //$NON-NLS-2$
- assertText(JBT_TEST_PROJECT_NAME+"/WebContent/pages", folderText); //$NON-NLS-1$
+ assertText(JBT_TEST_PROJECT_NAME+"/JavaSource", folderText); //$NON-NLS-1$
/*
* Check the file name
*/
@@ -666,6 +695,11 @@
assertNotNull("'File Name:' text field is not found", fileName); //$NON-NLS-1$
assertText("hello.properties", fileName); //$NON-NLS-1$
/*
+ * 'Next>' button should be disabled.
+ */
+ assertFalse("(Next>) button should be disabled.", //$NON-NLS-1$
+ bot.button(WidgetVariables.NEXT_BUTTON).isEnabled());
+ /*
* Create new file
*/
assertFalse("(OK) button should be disabled.", //$NON-NLS-1$
13 years, 7 months
JBoss Tools SVN: r26227 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-11-03 10:21:24 -0400 (Wed, 03 Nov 2010)
New Revision: 26227
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java
Log:
https://jira.jboss.org/browse/JBIDE-5134
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java 2010-11-03 14:14:14 UTC (rev 26226)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java 2010-11-03 14:21:24 UTC (rev 26227)
@@ -25,6 +25,7 @@
import org.eclipse.wst.validation.internal.operations.ValidatorManager;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.ui.marker.AddNewSeamRuntimeMarkerResolution;
import org.jboss.tools.seam.ui.marker.SeamRuntimeMarkerResolution;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -76,7 +77,8 @@
public void testJBide3989() throws CoreException {
IMarker[] markers = project.findMarkers(IMarker.PROBLEM, true,
IResource.DEPTH_INFINITE);
- boolean found = false;
+ boolean found1 = false;
+ boolean found2 = false;
for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i];
IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry()
@@ -84,15 +86,18 @@
for (int j = 0; j < resolutions.length; j++) {
IMarkerResolution resolution = resolutions[j];
if (resolution instanceof SeamRuntimeMarkerResolution) {
- found = true;
- break;
+ found1 = true;
}
+ if (resolution instanceof AddNewSeamRuntimeMarkerResolution) {
+ found2 = true;
+ }
}
- if (found) {
+ if (found1 && found2) {
break;
}
}
- assertTrue("The quickfix \"Set Seam Properties\" doesn't exist.", found);
+ assertTrue("The quickfix \"Set Seam Properties\" doesn't exist.", found1);
+ assertTrue("The quickfix \"Add New Seam Runtime\" doesn't exist.", found2);
}
}
13 years, 7 months