JBoss Tools SVN: r37190 - trunk/jsf/tests/org.jboss.tools.jsf.ui.test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-12-09 14:59:26 -0500 (Fri, 09 Dec 2011)
New Revision: 37190
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml
Log:
removed vpe.ui.palette from coverage report for jsf.ui.test
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml 2011-12-09 19:57:40 UTC (rev 37189)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml 2011-12-09 19:59:26 UTC (rev 37190)
@@ -12,7 +12,7 @@
<packaging>eclipse-test-plugin</packaging>
<properties>
- <emma.filter>org.jboss.tools.jsf.ui*,org.jboss.tools.vpe.ui.palette*</emma.filter>
- <emma.instrument.bundles>org.jboss.tools.jsf.ui,org.jboss.tools.vpe.ui.palette</emma.instrument.bundles>
+ <emma.filter>org.jboss.tools.jsf.ui*</emma.filter>
+ <emma.instrument.bundles>org.jboss.tools.jsf.ui</emma.instrument.bundles>
</properties>
</project>
14 years, 4 months
JBoss Tools SVN: r37189 - in trunk/jsf/tests/org.jboss.tools.jsf.test: src/org/jboss/tools/jsf/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-09 14:57:40 -0500 (Fri, 09 Dec 2011)
New Revision: 37189
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Tests are added.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml 2011-12-09 19:57:03 UTC (rev 37188)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml 2011-12-09 19:57:40 UTC (rev 37189)
@@ -2,6 +2,7 @@
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
<managed-bean>
<managed-bean-name>person</managed-bean-name>
<managed-bean-class>demo.Person</managed-bean-class>
@@ -18,9 +19,23 @@
<to-view-id>/pages/greeting.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>pages/inputname2.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/*</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/pages/greeting3.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>pages/greeting.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
<application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- <locale-config/>
+ <action-listener>actionListener</action-listener>
</application>
<factory/>
<lifecycle/>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-12-09 19:57:03 UTC (rev 37188)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-12-09 19:57:40 UTC (rev 37189)
@@ -24,6 +24,7 @@
import org.jboss.tools.jsf.test.refactoring.MessagePropertyRefactoringTest;
import org.jboss.tools.jsf.test.refactoring.MethodRefactoringTest;
import org.jboss.tools.jsf.test.validation.ELValidatorTest;
+import org.jboss.tools.jsf.test.validation.FacesConfigValidatorTest;
import org.jboss.tools.jsf.test.validation.JSF2ComponentsInClassFolderTest;
import org.jboss.tools.jsf.test.validation.JSF2ComponentsValidatorTest;
import org.jboss.tools.jsf.test.validation.WebContentTest;
@@ -83,7 +84,8 @@
new String[] { "JSFKickStartOldFormat" })); //$NON-NLS-1$
suite.addTest(new ValidationProjectTestSetup(new TestSuite(
JSF2ComponentsValidatorTest.class,
- JSF2ComponentsInClassFolderTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
+ JSF2ComponentsInClassFolderTest.class,
+ FacesConfigValidatorTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
new String[] { "projects/JSF2ComponentsValidator" }, //$NON-NLS-1$
new String[] { "JSF2ComponentsValidator" })); //$NON-NLS-1$
suite.addTest(new ProjectImportTestSetup(new TestSuite(
Added: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java 2011-12-09 19:57:40 UTC (rev 37189)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.test.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
+import org.jboss.tools.jsf.model.JSFConstants;
+import org.jboss.tools.jsf.web.validation.JSFValidationMessage;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class FacesConfigValidatorTest extends TestCase {
+
+ public static String PROJECT_NAME = "JSF2ComponentsValidator"; //$NON-NLS-1$
+ private IProject project;
+
+ public FacesConfigValidatorTest() {
+ super("JSF 2 Components Validator Test"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ }
+
+ public void testNavigation() throws Exception {
+ ValidationFramework.getDefault().validate(new IProject[] {project}, false, false, new NullProgressMonitor());
+ IResource resource = project.findMember("/WebContent/WEB-INF/faces-config.xml"); //$NON-NLS-1$
+ assertTrue(resource.exists());
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource, NLS.bind(JSFValidationMessage.VIEW_ID_NO_SLASH, JSFConstants.ATT_FROM_VIEW_ID), 23);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource, NLS.bind(JSFValidationMessage.TO_VIEW_ID_STAR, JSFConstants.ATT_TO_VIEW_ID), 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource, NLS.bind(JSFValidationMessage.VIEW_NOT_EXISTS, JSFConstants.ATT_TO_VIEW_ID, "/pages/greeting3.xhtml"), 30);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource, NLS.bind(JSFValidationMessage.VIEW_ID_NO_SLASH, JSFConstants.ATT_TO_VIEW_ID), 34);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 4 months
JBoss Tools SVN: r37188 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-09 14:57:03 -0500 (Fri, 09 Dec 2011)
New Revision: 37188
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Minor fixes.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java 2011-12-09 19:56:38 UTC (rev 37187)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/FacesConfigValidator.java 2011-12-09 19:57:03 UTC (rev 37188)
@@ -112,9 +112,10 @@
String ENT_APP = "JSFApplication", ENT_APP_12 = ENT_APP + SUFF_12, ENT_APP_20 = ENT_APP + SUFF_20;
addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_ACTION_LISTENER, "action-listener", false, "javax.faces.event.ActionListener", null), ENT_APP, ENT_APP_12, ENT_APP_20);
addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_NAVIGATION_HANDLER, "navigation-handler", false, "javax.faces.application.NavigationHandler", null), ENT_APP, ENT_APP_12, ENT_APP_20);
- addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_PROPERTY_RESOLVER, "property-resolver", false, "javax.faces.el.PropertyResolver", null), ENT_APP, ENT_APP_12, ENT_APP_20);
+ addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_PROPERTY_RESOLVER, "class name", false, "javax.faces.el.PropertyResolver", null).setVisualAttribute("property-resolver"), "JSFPropertyResolver");
addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_STATE_MANAGER, "state-manager", false, "javax.faces.application.StateManager", null), ENT_APP, ENT_APP_12, ENT_APP_20);
- addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_VARIABLE_RESOLVER, "variable-resolver", false, "javax.faces.el.VariableResolver", null), ENT_APP, ENT_APP_12, ENT_APP_20);
+ addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_VARIABLE_RESOLVER, "class name", false, "javax.el.ELResolver", null).setVisualAttribute("el-resolver"), "JSFELResolver");
+ addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_VARIABLE_RESOLVER, "class name", false, "javax.faces.el.VariableResolver", null).setVisualAttribute("variable-resolver"), "JSFVariableResolver");
addCheck(new CheckClass(this, JSFSeverityPreferences.INVALID_VIEW_HANDLER, "view-handler", false, "javax.faces.application.ViewHandler", null), ENT_APP, ENT_APP_12, ENT_APP_20);
String ENT_COMPONENT = "JSFComponent", ENT_COMPONENT_11 = ENT_COMPONENT + SUFF_11;
@@ -363,7 +364,7 @@
if(o == null) {
JSFUrlPattern pattern = JSFWebProject.getInstance(model).getUrlPattern();
if(pattern != null && pattern.isJSFUrl(value)) {
- attr = pattern.getJSFPath(value);
+ value = pattern.getJSFPath(value);
o = model.getByPath(value);
}
}
14 years, 4 months
JBoss Tools SVN: r37187 - trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-09 14:56:38 -0500 (Fri, 09 Dec 2011)
New Revision: 37187
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Minor fixes.
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java 2011-12-09 19:55:42 UTC (rev 37186)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java 2011-12-09 19:56:38 UTC (rev 37187)
@@ -16,14 +16,11 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.base.test.validation.TestUtil;
import org.jboss.tools.common.validation.ValidatorManager;
-import org.jboss.tools.jst.web.WebUtils;
import org.jboss.tools.jst.web.validation.WebXMLCoreValidator;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
@@ -97,10 +94,8 @@
}
static boolean hasMarkerOnLine(IMarker[] ms, int line) {
- System.out.println("-markers->" + ms.length);
for (IMarker m: ms) {
int l = m.getAttribute(IMarker.LINE_NUMBER, -1);
- System.out.println("---->" + l);
if(line == l) {
return true;
}
14 years, 4 months
JBoss Tools SVN: r37186 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-09 14:55:42 -0500 (Fri, 09 Dec 2011)
New Revision: 37186
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Minor fixes.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-12-09 19:35:08 UTC (rev 37185)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-12-09 19:55:42 UTC (rev 37186)
@@ -33,18 +33,25 @@
boolean allowsPrimitive = false;
String implementsType = null;
String extendsType = null;
+ String visualAttr;
public CheckClass(ValidationErrorManager manager, String preference, String attr) {
super(manager, preference, attr);
+ visualAttr = attr;
}
public CheckClass(ValidationErrorManager manager, String preference, String attr, boolean allowsPrimitive, String implementsType, String extendsType) {
- super(manager, preference, attr);
+ this(manager, preference, attr);
this.allowsPrimitive = allowsPrimitive;
this.implementsType = implementsType;
this.extendsType = extendsType;
}
+ public CheckClass setVisualAttribute(String v) {
+ visualAttr = v;
+ return this;
+ }
+
public void check(XModelObject object) {
if(attr == null) return;
String value = object.getAttributeValue(attr);
@@ -54,12 +61,12 @@
if(value.length() == 0 || isJavaLang(value)) return;
if(isPrimitive(value)) {
if(!allowsPrimitive) {
- fireNotExist(object, preference, attr, value);
+ fireNotExist(object, preference, value);
}
return;
}
if(!checkQualifiedName(value)) {
- fireInvalid(object, attr, attr, value);
+ fireInvalid(object, attr, value);
return;
}
IType type = getValidType(value, object);
@@ -81,18 +88,18 @@
LogHelper.logError("org.jboss.tools.jst.web.verification", e); //$NON-NLS-1$
}
if(mustImpl != null) {
- fireImplements(object, preference, attr, value, mustImpl);
+ fireImplements(object, preference, value, mustImpl);
}
String mustExtend = null;
try { mustExtend = checkExtends(object, type); } catch (Exception e) {
LogHelper.logError("org.jboss.tools.jst.web.verification", e); //$NON-NLS-1$
}
if(mustExtend != null) {
- fireExtends(object, preference, attr, value, mustExtend);
+ fireExtends(object, preference, value, mustExtend);
}
return;
}
- fireNotExist(object, preference, attr, value);
+ fireNotExist(object, preference, value);
}
private boolean checkQualifiedName(String value) {
@@ -148,18 +155,18 @@
}
}
- protected void fireImplements(XModelObject object, String id, String attr, String value, String interfaceName) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_IMPLEMENTS, new Object[] {attr, value, interfaceName}));
+ protected void fireImplements(XModelObject object, String id, String value, String interfaceName) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_IMPLEMENTS, new Object[] {visualAttr, value, interfaceName}));
}
- protected void fireExtends(XModelObject object, String id, String attr, String value, String superName) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXTENDS, new Object[] {attr, value, superName}));
+ protected void fireExtends(XModelObject object, String id, String value, String superName) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXTENDS, new Object[] {visualAttr, value, superName}));
}
- protected void fireInvalid(XModelObject object, String id, String attr, String value) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_VALID, attr, value));
+ protected void fireInvalid(XModelObject object, String id, String value) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_VALID, visualAttr, value));
}
- protected void fireNotExist(XModelObject object, String id, String attr, String value) {
- fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXISTS, attr, value));
+ protected void fireNotExist(XModelObject object, String id, String value) {
+ fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXISTS, visualAttr, value));
}
public static IType getValidType(String className, XModelObject o) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties 2011-12-09 19:35:08 UTC (rev 37185)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/messages.properties 2011-12-09 19:55:42 UTC (rev 37186)
@@ -2,16 +2,16 @@
VALIDATING_RESOURCE=project "{0}"; resource "{1}"
VALIDATING_PROJECT=project "{0}"
-PATH_EMPTY=Attribute {0} is empty
-PATH_NOT_EXISTS=Attribute {0} references to {1} that does not exist in web content
-PATH_NOT_TAGLIB=Attribute {0} references to {1} that is not tag library
-PATH_NOT_ICON=Attribute {0} references to {1} that is not an icon file
-PATH_NOT_PAGE=Attribute {0} references to {1} that is not a page file
-CLASS_NOT_EXISTS=Attribute {0} references to non-existent class {1}
-CLASS_NOT_IMPLEMENTS=Attribute {0} references to {1} that does not implement interface {2}
-CLASS_NOT_EXTENDS=Attribute {0} references to {1} that does not extend {2}
-CLASS_NOT_VALID=Attribute {0} must be valid fully qualified class name
+PATH_EMPTY={0} is empty
+PATH_NOT_EXISTS={0} references to {1} that does not exist in web content
+PATH_NOT_TAGLIB={0} references to {1} that is not tag library
+PATH_NOT_ICON={0} references to {1} that is not an icon file
+PATH_NOT_PAGE={0} references to {1} that is not a page file
+CLASS_NOT_EXISTS={0} references to non-existent class {1}
+CLASS_NOT_IMPLEMENTS={0} references to {1} that does not implement interface {2}
+CLASS_NOT_EXTENDS={0} references to {1} that does not extend {2}
+CLASS_NOT_VALID={0} must be valid fully qualified class name
EMPTY=Attribute {0} is empty
-SERVLET_NOT_EXISTS=Attribute {0} references to {1} that is not a servlet
-FILTER_NOT_EXISTS=Attribute {0} references to {1} that is not a filter
-ROLE_NOT_EXISTS=Attribute {0} references to {1} that is not a role
+SERVLET_NOT_EXISTS={0} references to {1} that is not a servlet
+FILTER_NOT_EXISTS={0} references to {1} that is not a filter
+ROLE_NOT_EXISTS={0} references to {1} that is not a role
14 years, 4 months
JBoss Tools SVN: r37185 - workspace/dgolovin/empty-composite-repo.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-12-09 14:35:08 -0500 (Fri, 09 Dec 2011)
New Revision: 37185
Added:
workspace/dgolovin/empty-composite-repo/compositeArtifacts.xml
workspace/dgolovin/empty-composite-repo/compositeContent.xml
Log:
fake empty repo
Added: workspace/dgolovin/empty-composite-repo/compositeArtifacts.xml
===================================================================
--- workspace/dgolovin/empty-composite-repo/compositeArtifacts.xml (rev 0)
+++ workspace/dgolovin/empty-composite-repo/compositeArtifacts.xml 2011-12-09 19:35:08 UTC (rev 37185)
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?compositeArtifactRepository version='1.0.0'?>
+<repository name='JBoss Tools Staging Repository' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
+<properties size='2'>
+<property name='p2.compressed' value='true'/>
+<!--
+ get new time w/
+ date +%s000
+-->
+<property name='p2.timestamp' value='1319582229000'/>
+</properties>
+<children size='0'/>
+</repository>
Added: workspace/dgolovin/empty-composite-repo/compositeContent.xml
===================================================================
--- workspace/dgolovin/empty-composite-repo/compositeContent.xml (rev 0)
+++ workspace/dgolovin/empty-composite-repo/compositeContent.xml 2011-12-09 19:35:08 UTC (rev 37185)
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?compositeMetadataRepository version='1.0.0'?>
+<repository name='JBoss Tools Staging Repository' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
+<properties size='2'>
+<property name='p2.compressed' value='true'/>
+<!--
+ get new time w/
+ date +%s000
+-->
+<property name='p2.timestamp' value='1319582229000'/>
+</properties>
+<children size='0' />
+
+</repository>
14 years, 4 months
JBoss Tools SVN: r37183 - trunk/jsf/tests.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-12-09 14:22:51 -0500 (Fri, 09 Dec 2011)
New Revision: 37183
Modified:
trunk/jsf/tests/pom.xml
Log:
coverage profile added to jsf/tests/pom.xml to let tracking coverage for jsf tests
Modified: trunk/jsf/tests/pom.xml
===================================================================
--- trunk/jsf/tests/pom.xml 2011-12-09 17:09:13 UTC (rev 37182)
+++ trunk/jsf/tests/pom.xml 2011-12-09 19:22:51 UTC (rev 37183)
@@ -11,21 +11,57 @@
<name>jsf.tests</name>
<packaging>pom</packaging>
- <modules>
- <module>org.jboss.tools.jsf.test</module>
- <module>org.jboss.tools.jsf.text.ext.test</module>
- <module>org.jboss.tools.jsf.ui.bot.test</module>
- <module>org.jboss.tools.jsf.ui.test</module>
- <module>org.jboss.tools.jsf.verification.test</module>
- <module>org.jboss.tools.jsf.vpe.ajax4jsf.test</module>
- <module>org.jboss.tools.jsf.vpe.facelets.test</module>
- <module>org.jboss.tools.jsf.vpe.jbpm.test</module>
- <module>org.jboss.tools.jsf.vpe.jsf.test</module>
- <module>org.jboss.tools.jsf.vpe.jstl.test</module>
- <module>org.jboss.tools.jsf.vpe.myfaces.test</module>
- <module>org.jboss.tools.jsf.vpe.richfaces.test</module>
- <module>org.jboss.tools.jsf.vpe.seam.test</module>
- </modules>
+
+ <profiles>
+ <profile>
+ <id>jsf-tests-libs</id>
+ <activation>
+ <property>
+ <name>jsf-coverage</name>
+ </property>
+ </activation>
+ <modules>
+ <module>../../build/libs</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>jsf-tests-default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>jsf-coverage</name>
+ </property>
+ </activation>
+ <modules>
+ <module>org.jboss.tools.jsf.test</module>
+ <module>org.jboss.tools.jsf.text.ext.test</module>
+ <module>org.jboss.tools.jsf.ui.bot.test</module>
+ <module>org.jboss.tools.jsf.ui.test</module>
+ <module>org.jboss.tools.jsf.verification.test</module>
+ <module>org.jboss.tools.jsf.vpe.ajax4jsf.test</module>
+ <module>org.jboss.tools.jsf.vpe.facelets.test</module>
+ <module>org.jboss.tools.jsf.vpe.jbpm.test</module>
+ <module>org.jboss.tools.jsf.vpe.jsf.test</module>
+ <module>org.jboss.tools.jsf.vpe.jstl.test</module>
+ <module>org.jboss.tools.jsf.vpe.myfaces.test</module>
+ <module>org.jboss.tools.jsf.vpe.richfaces.test</module>
+ <module>org.jboss.tools.jsf.vpe.seam.test</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>cdi-tests-coverage-report</id>
+ <activation>
+ <property>
+ <name>jsf-coverage</name>
+ </property>
+ </activation>
+ <modules>
+ <module>../../build/reports/emma-coverage</module>
+ </modules>
+ </profile>
+ </profiles>
<build>
<plugins>
<plugin>
14 years, 4 months
JBoss Tools SVN: r37182 - in trunk/forge/tests/org.jboss.tools.forge.ui.bot.test: src/org/jboss/tools/forge/ui/bot/test and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-12-09 12:09:13 -0500 (Fri, 09 Dec 2011)
New Revision: 37182
Added:
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/EntityTest.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/PersistenceTest.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ConsoleUtils.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ResourceUtils.java
Modified:
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/META-INF/MANIFEST.MF
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ForgeViewTest.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ProjectTest.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeAllTest.java
trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeTest.java
Log:
* forge ui.bot.tests
Modified: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/META-INF/MANIFEST.MF 2011-12-09 16:54:52 UTC (rev 37181)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/META-INF/MANIFEST.MF 2011-12-09 17:09:13 UTC (rev 37182)
@@ -12,4 +12,3 @@
org.jboss.tools.forge.core;bundle-version="1.0.0",
org.jboss.tools.forge.runtime;bundle-version="1.0.0",
org.jboss.tools.forge.runtime.ext;bundle-version="1.0.0"
-
Added: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/EntityTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/EntityTest.java (rev 0)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/EntityTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -0,0 +1,31 @@
+package org.jboss.tools.forge.ui.bot.test;
+
+import org.jboss.tools.forge.ui.bot.test.suite.ForgeTest;
+import org.jboss.tools.forge.ui.bot.test.util.ConsoleUtils;
+import org.junit.Test;
+
+public class EntityTest extends ForgeTest {
+
+ private static final String ENTITY_NAME = "testentity";
+ private static final String ENTITY_CREATED = "Created @Entity [" + PACKAGE_NAME + "." + ENTITY_NAME + "]";
+
+ @Test
+ public void newEntity(){
+
+ createProject(ProjectTypes.jar);
+ createPersistence();
+
+ getStyledText().setText("entity\n");
+ getStyledText().setText(ENTITY_NAME + "\n");
+ getStyledText().setText(PACKAGE_NAME + "\n");
+
+ assertTrue(ConsoleUtils.waitUntilTextInConsole(ENTITY_CREATED , TIME_1S, TIME_20S*3));
+ assertTrue(bot.editorByTitle(ENTITY_NAME + ".java").isActive());
+
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
+ }
+
+
+}
Modified: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ForgeViewTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ForgeViewTest.java 2011-12-09 16:54:52 UTC (rev 37181)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ForgeViewTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -1,14 +1,6 @@
package org.jboss.tools.forge.ui.bot.test;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.ui.part.PageBook;
-import org.hamcrest.Matcher;
import org.jboss.tools.forge.ui.bot.test.suite.ForgeTest;
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.junit.Test;
/**
@@ -25,7 +17,7 @@
}
-
+ @Test
public void forgeStartStop() {
if(isForgeRunning())
Added: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/PersistenceTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/PersistenceTest.java (rev 0)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/PersistenceTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -0,0 +1,125 @@
+package org.jboss.tools.forge.ui.bot.test;
+
+import java.io.IOException;
+
+import org.jboss.tools.forge.ui.bot.test.suite.ForgeTest;
+import org.jboss.tools.forge.ui.bot.test.util.ConsoleUtils;
+import org.jboss.tools.forge.ui.bot.test.util.ResourceUtils;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.junit.Test;
+/**
+ *
+ * @author psrna
+ *
+ */
+@Require(clearWorkspace=true)
+public class PersistenceTest extends ForgeTest {
+
+ @Test
+ public void hibernateJBossAS7(){
+
+ createProject(ProjectTypes.jar);
+
+ getStyledText().setText("persistence setup\n");
+ getStyledText().setText("HIBERNATE\n");
+ getStyledText().setText("JBOSS_AS7\n");
+ getStyledText().setText("N\n");
+
+ assertTrue(ConsoleUtils.waitUntilTextInConsole("persistence.xml", TIME_1S, TIME_20S*3));
+
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pContent = ResourceUtils.readFile(projectLocation + "/src/main/resources/META-INF/persistence.xml");
+ assertTrue(pContent.contains("<provider>org.hibernate.ejb.HibernatePersistence</provider>"));
+ assertTrue(pContent.contains("<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>"));
+ assertTrue(pContent.contains("<property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>"));
+ assertTrue(pContent.contains("<property name=\"hibernate.show_sql\" value=\"true\"/>"));
+ assertTrue(pContent.contains("<property name=\"hibernate.format_sql\" value=\"true\"/>"));
+ assertTrue(pContent.contains("<property name=\"hibernate.transaction.flush_before_completion\" value=\"true\"/>"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Attempt to read the 'persistence.xml' file failed!");
+ }
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void openjpaJBossAS7(){
+ createProject(ProjectTypes.jar);
+
+ getStyledText().setText("persistence setup\n");
+ getStyledText().setText("OPENJPA\n");
+ getStyledText().setText("JBOSS_AS7\n");
+ getStyledText().setText("N\n");
+
+ assertTrue(ConsoleUtils.waitUntilTextInConsole("persistence.xml", TIME_1S, TIME_20S*3));
+
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pContent = ResourceUtils.readFile(projectLocation + "/src/main/resources/META-INF/persistence.xml");
+ assertTrue(pContent.contains("<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>"));
+ assertTrue(pContent.contains("<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Attempt to read the 'persistence.xml' file failed!");
+ }
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void eclipselinkJBossAS7(){
+ createProject(ProjectTypes.jar);
+
+ getStyledText().setText("persistence setup\n");
+ getStyledText().setText("ECLIPSELINK\n");
+ getStyledText().setText("JBOSS_AS7\n");
+ getStyledText().setText("N\n");
+
+ assertTrue(ConsoleUtils.waitUntilTextInConsole("persistence.xml", TIME_1S, TIME_20S*3));
+
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pContent = ResourceUtils.readFile(projectLocation + "/src/main/resources/META-INF/persistence.xml");
+ assertTrue(pContent.contains("<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>"));
+ assertTrue(pContent.contains("<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>"));
+ assertTrue(pContent.contains("<property name=\"eclipselink.ddl-generation\" value=\"drop-and-create-tables\"/>"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Attempt to read the 'persistence.xml' file failed!");
+ }
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void infinispanJBossAS7(){
+ createProject(ProjectTypes.jar);
+
+ getStyledText().setText("persistence setup\n");
+ getStyledText().setText("INFINISPAN\n");
+ getStyledText().setText("JBOSS_AS7\n");
+ getStyledText().setText("N\n");
+
+ assertTrue(ConsoleUtils.waitUntilTextInConsole("persistence.xml", TIME_1S, TIME_20S*3));
+
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pContent = ResourceUtils.readFile(projectLocation + "/src/main/resources/META-INF/persistence.xml");
+ assertTrue(pContent.contains("<provider>org.hibernate.ogm.HibernateOgmPersistence</provider>"));
+ assertTrue(pContent.contains("<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>"));
+ assertTrue(pContent.contains("<property name=\"hibernate.dialect\" value=\"org.hibernate.ogm.dialect.NoopDialect\"/>"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Attempt to read the 'persistence.xml' file failed!");
+ }
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
+ }
+}
Modified: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ProjectTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ProjectTest.java 2011-12-09 16:54:52 UTC (rev 37181)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/ProjectTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -1,11 +1,10 @@
package org.jboss.tools.forge.ui.bot.test;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.ui.part.PageBook;
+import java.io.IOException;
import org.jboss.tools.forge.ui.bot.test.suite.ForgeTest;
+import org.jboss.tools.forge.ui.bot.test.util.ResourceUtils;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.junit.Test;
/**
@@ -13,29 +12,59 @@
* @author psrna
*
*/
+@Require(clearWorkspace=true)
public class ProjectTest extends ForgeTest {
- private static final String PROJECT_NAME = "testproject";
- private static final String PACKAGE_NAME = "org.jboss.testproject";
-
@Test
- public void newProject() {
+ public void pomProject() {
- openForgeView();
- startForge();
+ createProject(ProjectTypes.pom);
+
+ String text = getStyledText().getText();
+ assertTrue(text.contains("***SUCCESS*** Created project [" + PROJECT_NAME + "]"));
+ pExplorer.show();
+ assertTrue(pExplorer.existsResource(PROJECT_NAME));
+ assertTrue(pExplorer.existsResource(PROJECT_NAME, "pom.xml"));
+
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pomContent = ResourceUtils.readFile(projectLocation + "/pom.xml");
+ assertTrue(pomContent.contains("<packaging>pom</packaging>"));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ fail("Attempt to read the 'pom.xml' failed!");
+ }
+ getStyledText().setText("cd ..\n");
clear();
+ pExplorer.deleteAllProjects();
+ }
+
+ @Test
+ public void warProject() {
- getStyledText().setText("new-project\n");
- getStyledText().setText(PROJECT_NAME + "\n");
- getStyledText().setText(PACKAGE_NAME + "\n");
- getStyledText().setText("Y\n");
+ createProject(ProjectTypes.war);
- bot.sleep(TIME_10S);
-
String text = getStyledText().getText();
assertTrue(text.contains("***SUCCESS*** Created project [" + PROJECT_NAME + "]"));
+ pExplorer.show();
assertTrue(pExplorer.existsResource(PROJECT_NAME));
+ assertTrue(pExplorer.existsResource(PROJECT_NAME, "pom.xml"));
+ String projectLocation = SWTUtilExt.getPathToProject(PROJECT_NAME);
+ try {
+ String pomContent = ResourceUtils.readFile(projectLocation + "/pom.xml");
+ assertTrue(pomContent.contains("<packaging>war</packaging>"));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ fail("Attempt to read the 'pom.xml' failed!");
+ }
+ getStyledText().setText("cd ..\n");
+ clear();
+ pExplorer.deleteAllProjects();
}
+
+
}
Modified: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeAllTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeAllTest.java 2011-12-09 16:54:52 UTC (rev 37181)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeAllTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -1,6 +1,8 @@
package org.jboss.tools.forge.ui.bot.test.suite;
+import org.jboss.tools.forge.ui.bot.test.EntityTest;
import org.jboss.tools.forge.ui.bot.test.ForgeViewTest;
+import org.jboss.tools.forge.ui.bot.test.PersistenceTest;
import org.jboss.tools.forge.ui.bot.test.ProjectTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
@@ -14,7 +16,9 @@
*/
@SuiteClasses({
ForgeViewTest.class,
- ProjectTest.class
+ ProjectTest.class,
+ PersistenceTest.class,
+ EntityTest.class
})
@RunWith(RequirementAwareSuite.class)
public class ForgeAllTest {
Modified: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeTest.java 2011-12-09 16:54:52 UTC (rev 37181)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/suite/ForgeTest.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -2,14 +2,19 @@
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import org.eclipse.ui.part.PageBook;
+import org.jboss.tools.forge.ui.bot.test.util.ConsoleUtils;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
+import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
/**
*
@@ -18,9 +23,51 @@
*/
public class ForgeTest extends SWTTestExt {
+ protected static final String PROJECT_NAME = "testproject";
+ protected static final String PACKAGE_NAME = "org.jboss.testproject";
+
protected PackageExplorer pExplorer = new PackageExplorer();
- protected SWTBotView openForgeView(){
+ @BeforeClass
+ public static void setup(){
+ openForgeView();
+ startForge();
+ clear();
+ }
+
+ @AfterClass
+ public static void cleanup(){
+ //TODO?
+ }
+
+ public enum ProjectTypes{
+ jar, war, pom
+ }
+
+ protected void createProject(ProjectTypes type){
+
+ getStyledText().setText("new-project --type " + type + "\n");
+ getStyledText().setText(PROJECT_NAME + "\n");
+ getStyledText().setText(PACKAGE_NAME + "\n");
+ getStyledText().setText("Y\n");
+
+ ConsoleUtils.waitUntilTextInConsole("project [" + PROJECT_NAME + "]", TIME_1S, TIME_20S*3);
+
+ util.waitForJobs("Importing Forge project"); //see org.jboss.tools.forge.importer#importProject()
+ }
+
+ protected void createPersistence(){
+
+ getStyledText().setText("persistence setup\n");
+ getStyledText().setText("HIBERNATE\n");
+ getStyledText().setText("JBOSS_AS7\n");
+ getStyledText().setText("N\n");
+
+ ConsoleUtils.waitUntilTextInConsole("persistence.xml", TIME_1S, TIME_20S*3);
+ }
+
+
+ public static SWTBotView openForgeView(){
if(isForgeViewActive())
return getForgeView();
@@ -38,7 +85,7 @@
return view;
}
- protected void clear() {
+ public static void clear() {
if(!isForgeViewActive())
openForgeView();
if(!isForgeRunning())
@@ -52,14 +99,14 @@
* This is private, use openForgeView method outside this class to get
* Forge Console View.
*/
- private SWTBotView getForgeView(){
+ public static SWTBotView getForgeView(){
SWTBotView view = bot.viewByTitle("Forge Console");
view.setFocus();
view.show();
return view;
}
- protected boolean isForgeViewActive(){
+ public static boolean isForgeViewActive(){
try{
SWTBotView view = getForgeView();
@@ -73,7 +120,7 @@
return false;
}
- protected boolean isForgeRunning(){
+ public static boolean isForgeRunning(){
if(!isForgeViewActive())
openForgeView();
@@ -103,31 +150,36 @@
return false;
}
- protected void startForge(){
+ public static void startForge(){
if(!isForgeViewActive())
openForgeView();
SWTBotView view = getForgeView();
view.toolbarButton("Start Forge").click();
- bot.sleep(TIME_5S);
+
+ util.waitForJobs("Starting Forge"); //see org.jboss.tools.forge.ui.part#startForge()
}
- protected void stopForge(){
+ public static void stopForge(){
if(!isForgeViewActive())
openForgeView();
SWTBotView view = getForgeView();
view.toolbarButton("Stop Forge").click();
- bot.sleep(TIME_1S);
+ bot.sleep(TIME_5S);
}
- protected SWTBotStyledText getStyledText(){
+ public static SWTBotStyledText getStyledText(){
SWTBotView view = getForgeView();
PageBook pb = view.bot().widget(widgetOfType(PageBook.class));
SWTBot pbbot = new SWTBot(pb);
return pbbot.styledText();
}
+ public static SWTBot getForgeViewBot(){
+ return bot.viewByTitle("Forge Console").bot();
+ }
+
}
Added: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ConsoleUtils.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ConsoleUtils.java (rev 0)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ConsoleUtils.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -0,0 +1,38 @@
+package org.jboss.tools.forge.ui.bot.test.util;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.forge.ui.bot.test.suite.ForgeTest;
+
+public class ConsoleUtils {
+
+
+ /**
+ *
+ * @param text
+ * @param sleepTime
+ * @param timeOut
+ * @return true if text found in Forge Console
+ */
+ public static boolean waitUntilTextInConsole(String text, long sleepTime, long timeOut){
+
+ if(!ForgeTest.isForgeViewActive())
+ return false;
+
+ SWTBot viewBot = ForgeTest.getForgeViewBot();
+ String consoleText = ForgeTest.getStyledText().getText();
+
+ long estimatedTime = 0;
+
+ while ((estimatedTime < timeOut) && (!consoleText.contains(text)) ){
+ viewBot.sleep(sleepTime);
+ estimatedTime += sleepTime;
+ consoleText = ForgeTest.getStyledText().getText();
+ }
+ if(consoleText.contains(text))
+ return true;
+ else
+ return false;
+
+ }
+
+}
Added: trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ResourceUtils.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ResourceUtils.java (rev 0)
+++ trunk/forge/tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/ResourceUtils.java 2011-12-09 17:09:13 UTC (rev 37182)
@@ -0,0 +1,25 @@
+package org.jboss.tools.forge.ui.bot.test.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+
+public class ResourceUtils {
+
+ public static String readFile(String path) throws IOException {
+ FileInputStream stream = new FileInputStream(new File(path));
+ try {
+ FileChannel fc = stream.getChannel();
+ MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+ /* Instead of using default, pass in a decoder. */
+ return Charset.defaultCharset().decode(bb).toString();
+ }
+ finally {
+ stream.close();
+ }
+ }
+
+}
14 years, 4 months
JBoss Tools SVN: r37181 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-12-09 11:54:52 -0500 (Fri, 09 Dec 2011)
New Revision: 37181
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/ImportFailedException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/WontOverwriteException.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ImageRepository.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftImages.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/Logger.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreationLogDialog.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
Log:
cleaned package structure
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/ImportFailedException.java (from rev 37167, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImportFailedException.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/ImportFailedException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/ImportFailedException.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.express.internal.ui;
+
+public class ImportFailedException extends OpenShiftUIException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ImportFailedException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/ImportFailedException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftImages.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftImages.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftImages.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -12,7 +12,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.openshift.express.internal.ui.common.ImageRepository;
+import org.jboss.tools.openshift.express.internal.ui.utils.ImageRepository;
public class OpenShiftImages {
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIException.java (from rev 37167, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/OpenShiftUIException.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIException.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.express.internal.ui;
+
+import org.jboss.tools.openshift.express.client.OpenShiftException;
+
+public class OpenShiftUIException extends OpenShiftException {
+
+ private static final long serialVersionUID = 1L;
+
+ public OpenShiftUIException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+
+ public OpenShiftUIException(Throwable cause, String message, Object... arguments) {
+ super(cause, message, arguments);
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/WontOverwriteException.java (from rev 37167, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/WontOverwriteException.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/WontOverwriteException.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/WontOverwriteException.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.express.internal.ui;
+
+public class WontOverwriteException extends OpenShiftUIException {
+
+ private static final long serialVersionUID = 1L;
+
+ public WontOverwriteException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/WontOverwriteException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -22,7 +22,7 @@
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.MessageConsole;
-import org.jboss.tools.openshift.express.internal.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
/**
* A utility class to manager the message consoles creations and retrivals
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -29,7 +29,7 @@
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogWorker.JschToEclipseLogger;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
-import org.jboss.tools.openshift.express.internal.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -54,7 +54,7 @@
console.newMessageStream().println(line);
}
} catch (Throwable e) {
- org.jboss.tools.openshift.express.internal.utils.Logger.error(
+ org.jboss.tools.openshift.express.internal.ui.utils.Logger.error(
"Error while receiving the remote server log", e);
} finally {
@@ -99,14 +99,14 @@
switch (level) {
case DEBUG:
case INFO:
- org.jboss.tools.openshift.express.internal.utils.Logger.debug(message);
+ org.jboss.tools.openshift.express.internal.ui.utils.Logger.debug(message);
break;
case WARN:
- org.jboss.tools.openshift.express.internal.utils.Logger.warn(message);
+ org.jboss.tools.openshift.express.internal.ui.utils.Logger.warn(message);
break;
case ERROR:
case FATAL:
- org.jboss.tools.openshift.express.internal.utils.Logger.error(message);
+ org.jboss.tools.openshift.express.internal.ui.utils.Logger.error(message);
break;
}
}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java (from rev 37146, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.express.internal.ui.utils;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author André Dietisheim
+ */
+public class FileUtils {
+
+ private static final byte[] buffer = new byte[1024];
+
+ public static boolean canRead(String path) {
+ if (path == null) {
+ return false;
+ }
+ return canRead(new File(path));
+ }
+
+ public static boolean canRead(File file) {
+ if (file == null) {
+ return false;
+ }
+ return file.canRead();
+ }
+
+ public static boolean exists(File file) {
+ return file != null
+ && file.exists();
+ }
+
+ public static boolean isDirectory(File file) {
+ return file != null
+ && file.isDirectory();
+ }
+
+ public static File getSystemTmpFolder() {
+ String tmpFolder = System.getProperty("java.io.tmpdir");
+ return new File(tmpFolder);
+ }
+
+ public static File getRandomTmpFolder() {
+ String randomName = String.valueOf(System.currentTimeMillis());
+ return new File(getSystemTmpFolder(), randomName);
+ }
+
+ /**
+ * Copies the ginve source to the given destination recursively. Overwrites
+ * existing files/directory on the destination path if told so.
+ *
+ * @param source
+ * the source file/directory to copy
+ * @param destination
+ * the destination to copy to
+ * @param overwrite
+ * overwrites existing files/directories if <code>true</code>.
+ * Does not overwrite otherwise.
+ * @throws IOException
+ */
+ public static void copy(File source, File destination, boolean overwrite) throws IOException {
+ if (!exists(source)
+ || destination == null) {
+ return;
+ }
+
+ if (source.isDirectory()) {
+ copyDirectory(source, destination, overwrite);
+ } else {
+ copyFile(source, destination, overwrite);
+ }
+ }
+
+ private static void copyDirectory(File source, File destination, boolean overwrite) throws IOException {
+ Assert.isLegal(source != null);
+ Assert.isLegal(source.isDirectory());
+ Assert.isLegal(destination != null);
+
+ destination = getDestinationDirectory(source, destination);
+
+ if (!destination.exists()) {
+ destination.mkdir();
+ }
+
+ for (File content : source.listFiles()) {
+ if (content.isDirectory()) {
+ copyDirectory(content, new File(destination, content.getName()), overwrite);
+ } else {
+ copyFile(content, new File(destination, content.getName()), overwrite);
+ }
+ }
+ }
+
+ private static File getDestinationDirectory(File source, File destination) {
+ if (!source.getName().equals(destination.getName())) {
+ destination = new File(destination, source.getName());
+ }
+ return destination;
+ }
+
+ private static void copyFile(File source, File destination, boolean overwrite) throws IOException {
+ Assert.isLegal(source != null);
+ Assert.isLegal(source.isFile());
+ Assert.isLegal(destination != null);
+
+ destination = getDestinationFile(source, destination);
+
+ if (exists(destination)
+ && !overwrite) {
+ return;
+ }
+
+ if (isDirectory(destination)) {
+ if (!overwrite) {
+ return;
+ }
+ destination.delete();
+ }
+
+ writeTo(source, destination);
+ }
+
+ private static File getDestinationFile(File source, File destination) {
+ if (!source.getName().equals(destination.getName())) {
+ destination = new File(destination, source.getName());
+ }
+ return destination;
+ }
+
+ private static final void writeTo(File source, File destination) throws IOException {
+ Assert.isLegal(source != null);
+ Assert.isLegal(destination != null);
+
+ InputStream in = null;
+ writeTo(new BufferedInputStream(new FileInputStream(source)), destination);
+ }
+
+ private static final void writeTo(InputStream in, File destination) throws IOException {
+ Assert.isLegal(in != null);
+ Assert.isLegal(destination != null);
+
+ OutputStream out = null;
+ try {
+ out = new BufferedOutputStream(new FileOutputStream(destination));
+ for (int read = -1; (read = in.read(buffer)) != -1; ) {
+ out.write(buffer, 0, read);
+ }
+ out.flush();
+ } finally {
+ silentlyClose(in);
+ silentlyClose(out);
+ }
+ }
+
+ private static void silentlyClose(InputStream in) {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ private static void silentlyClose(OutputStream out) {
+ try {
+ if (out != null) {
+ out.close();
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ImageRepository.java (from rev 37146, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/ImageRepository.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ImageRepository.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/ImageRepository.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+public class ImageRepository {
+
+ private ImageRegistry imageRegistry;
+ private URL baseUrl;
+ private Plugin plugin;
+ private String imageFolder;
+
+ public ImageRepository(String imageFolder, Plugin plugin, ImageRegistry imageRegistry) {
+ this.imageFolder = imageFolder;
+ this.plugin = plugin;
+ this.imageRegistry = imageRegistry;
+ }
+
+ protected URL getBaseUrl() {
+ try {
+ if (baseUrl == null) {
+ this.baseUrl = new URL(plugin.getBundle().getEntry("/"), imageFolder);
+ }
+ return baseUrl;
+ } catch (MalformedURLException e) {
+ OpenShiftUIActivator.log(e);
+ return null;
+ }
+ }
+
+ public ImageDescriptor create(String name) {
+ return create(imageRegistry, name);
+ }
+
+ private ImageDescriptor create(ImageRegistry registry,String name) {
+ return create(registry, name, getBaseUrl());
+ }
+
+ private ImageDescriptor create(ImageRegistry registry, String name, URL baseUrl) {
+ if (baseUrl == null) {
+ return null;
+ }
+
+ ImageDescriptor imageDescriptor =
+ ImageDescriptor.createFromURL(createFileURL(name, baseUrl));
+ registry.put(name, imageDescriptor);
+ return imageDescriptor;
+ }
+
+ private URL createFileURL(String name, URL baseUrl) {
+ try {
+ return new URL(baseUrl, name);
+ } catch (MalformedURLException e) {
+ plugin.getLog().log(
+ new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), NLS.bind(
+ "Could not create URL for image {0}", name), e));
+ return null;
+ }
+ }
+
+ public Image getImage(String name) {
+ return imageRegistry.get(name);
+ }
+}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/Logger.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java 2011-12-09 09:17:16 UTC (rev 37146)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/Logger.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -9,7 +9,7 @@
* Xavier Coulon - Initial API and implementation
******************************************************************************/
-package org.jboss.tools.openshift.express.internal.utils;
+package org.jboss.tools.openshift.express.internal.ui.utils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java (from rev 37146, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/StringUtils.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.express.internal.ui.utils;
+
+import java.util.List;
+
+/**
+ * @author André Dietisheim
+ */
+public class StringUtils {
+
+ private static final String LINE_SEPARATOR_KEY = "line.separator";
+
+ public static String null2emptyString(String value) {
+ if (value != null) {
+ return value;
+ }
+ return "";
+ }
+
+ public static boolean isEmpty(String value) {
+ return value == null
+ || value.length() == 0;
+ }
+
+ public static <T> String toString(List<T> elements, ToStringConverter<T> converter) {
+ StringBuilder builder = new StringBuilder();
+ for(int i = 0; i < elements.size(); i++) {
+ converter.toString(elements.get(i));
+ builder.append(converter.toString(elements.get(i)));
+ if (i + 1 < elements.size()) {
+ builder.append(", ");
+ }
+ }
+ return builder.toString();
+ }
+
+ public static interface ToStringConverter<T> {
+ public String toString(T object);
+ }
+
+ public static String getLineSeparator() {
+ return System.getProperty(LINE_SEPARATOR_KEY);
+ }
+
+
+}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/UIUtils.java 2011-12-09 09:17:16 UTC (rev 37146)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.openshift.express.internal.utils;
+package org.jboss.tools.openshift.express.internal.ui.utils;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -33,7 +33,7 @@
import org.jboss.tools.openshift.express.client.utils.RFC822DateUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -60,8 +60,8 @@
import org.jboss.tools.openshift.express.client.NotFoundOpenShiftException;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-import org.jboss.tools.openshift.express.internal.utils.Logger;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreationLogDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreationLogDialog.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreationLogDialog.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -32,7 +32,7 @@
import org.jboss.tools.common.ui.BrowserUtil;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -40,8 +40,8 @@
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-import org.jboss.tools.openshift.express.internal.utils.UIUtils;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -55,7 +55,7 @@
import org.jboss.tools.openshift.express.client.IEmbeddableCartridge;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.CreationLogDialog.LogEntry;
/**
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -49,8 +49,8 @@
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -24,7 +24,7 @@
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.client.SSHKeyPair;
import org.jboss.tools.openshift.express.client.SSHPublicKey;
-import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
/**
* @author André Dietisheim
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -14,7 +14,7 @@
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
public class PassphraseDialog extends InputDialog {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AddToExistingProjectStrategy.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -31,7 +31,7 @@
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.IUser;
import org.jboss.tools.openshift.express.client.OpenShiftException;
-import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
/**
* @author André Dietisheim <adietish(a)redhat.com>
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProjectStrategy.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -30,8 +30,8 @@
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.IUser;
import org.jboss.tools.openshift.express.client.OpenShiftException;
-import org.jboss.tools.openshift.express.internal.ui.common.ImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
+import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
+import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.GeneralProjectImportOperation;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.MavenProjectImportOperation;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2011-12-09 16:54:13 UTC (rev 37180)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2011-12-09 16:54:52 UTC (rev 37181)
@@ -32,9 +32,9 @@
import org.eclipse.ui.IWorkbench;
import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.client.OpenShiftException;
+import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.common.ImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.common.WontOverwriteException;
+import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPage;
import org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationWizardPage;
import org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardPage;
14 years, 4 months