Author: akazakov
Date: 2012-02-29 21:16:54 -0500 (Wed, 29 Feb 2012)
New Revision: 39213
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ComponentsFromLibTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/Seam2ValidatorTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamModelStorageTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeManagerTest.java
Log:
https://issues.jboss.org/browse/JBIDE-10956 test failures in Seam
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -115,6 +115,10 @@
protected int modifications = 0;
protected boolean isBuilt = false;
+ private void inc() {
+ modifications++;
+ }
+
/**
*
*/
@@ -289,7 +293,7 @@
public void addSeamProject(SeamProject p) {
if(dependsOn.contains(p)) return;
dependsOn.add(p);
- modifications++;
+ inc();;
p.addDependentSeamProject(this);
if(!p.isStorageResolved) {
p.resolve();
@@ -320,7 +324,7 @@
* @param p
*/
public void addDependentSeamProject(SeamProject p) {
- if(usedBy.add(p)) modifications++;
+ if(usedBy.add(p)) inc();;
}
public Map<String, Set<ISeamNamespace>> getNamespaces() {
@@ -335,7 +339,7 @@
if(!dependsOn.contains(p)) return;
p.usedBy.remove(this);
dependsOn.remove(p);
- modifications++;
+ inc();;
IPath[] ps = sourcePaths2.keySet().toArray(new IPath[0]);
for (int i = 0; i < ps.length; i++) {
IPath pth = ps[i];
@@ -522,32 +526,44 @@
if(validationContext != null)
System.out.println("validationContext " +
validationContext.getModificationsSinceLastStore());
}
-
+
+ private boolean storeDisabledForTesting; // Should be used for testing only!
+
/**
+ * Should be used for testing only!
+ * @param disable
+ */
+ public void setStoreDisabledForTesting(boolean disable) {
+ this.storeDisabledForTesting = disable;
+ }
+
+ /**
* Stores results of last build, so that on exit/enter Eclipse
* load them without rebuilding project
* @throws IOException
*/
public void store() throws IOException {
- File file = getStorageFile();
- if(file != null) {
- file.getParentFile().mkdirs();
-
- Element root = XMLUtilities.createDocumentElement("seam-project");
//$NON-NLS-1$
- storeProjectDependencies(root);
-
- storeNamespaces(root);
-// storeSourcePaths(root);
- storeSourcePaths2(root);
-
- if(validationContext != null) validationContext.store(root);
-
- XMLUtilities.serialize(root, file.getAbsolutePath());
-
- modifications = 0;
- namespaces.modifications = 0;
- components.modifications = 0;
- factories.modifications = 0;
+ if(!storeDisabledForTesting) {
+ File file = getStorageFile();
+ if(file != null) {
+ file.getParentFile().mkdirs();
+
+ Element root = XMLUtilities.createDocumentElement("seam-project");
//$NON-NLS-1$
+ storeProjectDependencies(root);
+
+ storeNamespaces(root);
+ // storeSourcePaths(root);
+ storeSourcePaths2(root);
+
+ if(validationContext != null) validationContext.store(root);
+
+ XMLUtilities.serialize(root, file.getAbsolutePath());
+
+ modifications = 0;
+ namespaces.modifications = 0;
+ components.modifications = 0;
+ factories.modifications = 0;
+ }
}
}
@@ -751,10 +767,10 @@
long t2 = System.currentTimeMillis();
if(statistics != null) {
statistics.add(new Long(t2 - t1));
- if(t2 - t1 > 30) {
- System.out.println("--->" + statistics.size() + " " + (t2 -
t1));
- System.out.println("stop");
- }
+// if(t2 - t1 > 30) {
+// System.out.println("--->" + statistics.size() + " " + (t2 -
t1));
+// System.out.println("stop");
+// }
}
}
postBuild();
@@ -1419,7 +1435,7 @@
public void setImports(IPath source, List<SeamImport> paths) {
if(equalLists(imports.importsBySource.get(source), paths)) return;
- modifications++;
+ inc();;
synchronized(variables) {
variables.allVariablesPlusShort = null;
variables.byName = null;
@@ -1438,7 +1454,7 @@
public void removeImports(IPath source) {
if(!imports.importsBySource.containsKey(source)) return;
- modifications++;
+ inc();;
synchronized(variables) {
variables.allVariablesPlusShort = null;
}
@@ -1734,7 +1750,7 @@
*/
void fireChanges(List<Change> changes, boolean increaseModification) {
if(changes == null || changes.isEmpty()) return;
- if(increaseModification) modifications++;
+ if(increaseModification) inc();;
if(postponedChanges != null) {
postponedChanges.addAll(changes);
return;
@@ -1962,7 +1978,7 @@
protected int modifications = 0;
protected void increaseModification(IPath path) {
- if(pathCheck.isThisProject(path)) modifications++;
+ if(pathCheck.isThisProject(path)) inc();;
}
}
@@ -2323,7 +2339,7 @@
addVariable(f);
if(f instanceof SeamMessages && f != messages) {
messages = (SeamMessages)f;
- modifications++;
+ inc();;
}
}
@@ -2360,7 +2376,7 @@
removeVariable(f);
if(f == messages) {
messages = null;
- modifications++;
+ inc();;
}
}
if(factoriesBySource.remove(path) != null) increaseModification(path);
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ComponentsFromLibTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ComponentsFromLibTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ComponentsFromLibTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCoreBuilder;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
@@ -36,37 +37,33 @@
IProject project1;
TestProjectProvider provider1;
+ @Override
protected void setUp() throws Exception {
provider1 = new TestProjectProvider(BUNDLE,"/projects/SeamJava" ,
"SeamJava", true);
project1 = provider1.getProject();
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
-
+
IFile source = project1.getFile(new Path("lib/jboss-seam.1"));
IFile target = project1.getFile(new Path("lib/jboss-seam.jar"));
target.create(source.getContents(), IResource.FORCE, new NullProgressMonitor());
- //To ensure that the project is built.
- project1.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ project1.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
NullProgressMonitor());
- project1.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ project1.build(IncrementalProjectBuilder.FULL_BUILD, SeamCoreBuilder.BUILDER_ID, null,
new NullProgressMonitor());
JobUtils.waitForIdle();
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
}
-
+
public void testComponentsFromLib() {
ISeamProject sp1 = getSeamProject1();
-
+
String component = "org.jboss.seam.core.conversation";
assertNotNull("Bean " + component + " is not found in project
CycleTest1", sp1.getComponent(component));
-
}
-
private ISeamProject getSeamProject1() {
ISeamProject seamProject = null;
try {
@@ -77,15 +74,12 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
+
@Override
protected void tearDown() throws Exception {
ISeamProject sp1 = getSeamProject1();
SeamProject impl1 = (SeamProject)sp1;
if(impl1 != null) impl1.clearStorage();
-
- JobUtils.waitForIdle();
provider1.dispose();
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/CyclicDependingProjectsTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -18,7 +18,6 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.TestProjectProvider;
@@ -35,6 +34,7 @@
IProject project2;
TestProjectProvider provider2;
+ @Override
protected void setUp() throws Exception {
provider1 = new TestProjectProvider(BUNDLE,"/projects/CycleTest1" ,
"CycleTest1", true);
project1 = provider1.getProject();
@@ -42,7 +42,6 @@
project2 = provider2.getProject();
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
//To ensure that the project is built.
project1.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
@@ -56,7 +55,7 @@
public void testCyclicDependingProjects() {
ISeamProject sp1 = getSeamProject1();
-
+
assertNotNull("Bean test.bean1 is not found in project CycleTest1",
sp1.getComponent("test.bean1"));
assertNotNull("Bean test.bean2 is not found in project CycleTest1",
sp1.getComponent("test.bean2"));
@@ -66,7 +65,6 @@
assertNotNull("Bean test.bean2 is not found in project CycleTest2",
sp2.getComponent("test.bean2"));
}
-
private ISeamProject getSeamProject1() {
ISeamProject seamProject = null;
try {
@@ -77,7 +75,7 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
+
private ISeamProject getSeamProject2() {
ISeamProject seamProject = null;
try {
@@ -88,7 +86,7 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
+
@Override
protected void tearDown() throws Exception {
ISeamProject sp1 = getSeamProject1();
@@ -99,9 +97,7 @@
SeamProject impl2 = (SeamProject)sp2;
if(impl2 != null) impl2.clearStorage();
- JobUtils.waitForIdle();
provider1.dispose();
provider2.dispose();
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -49,7 +49,7 @@
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.TestProjectProvider;
public class ScannerTest extends TestCase {
@@ -69,9 +69,7 @@
project = provider.getProject();
}
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- JobUtils.waitForIdle();
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- JobUtils.waitForIdle();
}
private ISeamProject getSeamProject() {
@@ -94,13 +92,13 @@
IFile f = project.getFile("WebContent/WEB-INF/components.xml");
assertTrue("Cannot find components.xml in test project", f != null &&
f.exists());
-
+
IFileScanner scanner = SeamCoreBuilder.createXMLScanner();
assertTrue("Scanner cannot recognise components.xml",
scanner.isRelevant(f));
assertTrue("Scanner cannot recognise components.xml content",
scanner.isLikelyComponentSource(f));
ISeamComponentDeclaration[] cs = null;
ISeamFactory[] fs = null;
-
+
try {
LoadedDeclarations ds = scanner.parse(f, seamProject);
cs = ds.getComponents().toArray(new ISeamComponentDeclaration[0]);
@@ -136,7 +134,7 @@
assertTrue("Property myList in myComponent must be instanceof
ISeamValueList", o instanceof ISeamValueList);
ISeamValueList oList = (ISeamValueList)o;
assertTrue("Property myList misses value 'value1.",
"value1".equals(oList.getValues().get(0).getValue().getValue()));
-
+
property = ((ISeamXmlComponentDeclaration)myComponent).getProperty("myMap");
assertTrue("Property myMap is not found in declaration
'myComponent'", property != null);
o = property.getValue();
@@ -147,7 +145,7 @@
assertTrue("First entry in myMap must have key='key1'",
"key1".equals(es.get(0).getKey().getValue().getValue()));
assertTrue("First entry in myMap must have value='map value 1'",
"map value 1".equals(es.get(0).getValue().getValue().getValue()));
-
+
//2. components.xml has entry
// <core:resource-bundle>
// <core:bundle-names>
@@ -167,7 +165,7 @@
oList = (ISeamValueList)o;
assertTrue("Property bundleNames misses value 'bundleA'.",
"bundleA".equals(oList.getValues().get(0).getValue().getValue()));
assertTrue("Property bundleNames misses value 'bundleB'.",
"bundleB".equals(oList.getValues().get(1).getValue().getValue()));
-
+
//3. components.xml has entry
//<factory name="factory1" scope="conversation"/>
// check that
@@ -177,7 +175,7 @@
assertTrue("Declared factory 'factory1' is not found in
components.xml", factory != null);
ISeamXmlFactory af = (ISeamXmlFactory)factory;
assertTrue("Scope of 'factory1' must be 'conversation'",
af.getScope() == ScopeType.CONVERSATION);
-
+
//4. components.xml has duplicated entry
//<component class="java.lang.Boolean" name="duplicated"/>
// check that
@@ -187,7 +185,7 @@
if("duplicated".equals(cs[i].getName())) duplicatedCount++;
}
assertEquals("There are 2 declarations of component \"duplicated\" in
xml.", 2, duplicatedCount);
-
+
//5. components.xml has components with different precedence.
ISeamComponentDeclaration c10 = findDeclaration(cs, "compWithPrecedence10");
assertNotNull(c10);
@@ -199,26 +197,26 @@
assertNotNull(c20);
assertEquals("20", ((ISeamXmlComponentDeclaration)c20).getPrecedence());
}
-
+
private ISeamComponentDeclaration findDeclaration(ISeamComponentDeclaration[]
declarations, String name) {
for (int i = 0; i < declarations.length; i++) {
if(name.equals(declarations[i].getName())) return declarations[i];
}
return null;
}
-
+
public void testJavaScanner() {
ISeamProject seamProject = getSeamProject();
-
+
IFile f = project.getFile("JavaSource/demo/User.java");
assertTrue("Cannot find User.java in test project", f != null &&
f.exists());
-
+
IFileScanner scanner = SeamCoreBuilder.createJavaScanner();
assertTrue("Scanner cannot recognise User.java", scanner.isRelevant(f));
assertTrue("Scanner cannot recognise User.java content",
scanner.isLikelyComponentSource(f));
ISeamComponentDeclaration[] cs = null;
ISeamFactory[] fs = null;
-
+
try {
LoadedDeclarations ds = scanner.parse(f, seamProject);
cs = ds.getComponents().toArray(new ISeamComponentDeclaration[0]);
@@ -227,7 +225,7 @@
JUnitUtils.fail("Error in java scanner",e);
}
assertTrue("Components are not found in User.java", cs != null &&
cs.length > 0);
-
+
ISeamJavaComponentDeclaration myUser =
(ISeamJavaComponentDeclaration)findDeclaration(cs, "myUser");
assertTrue("Component declaration myUser not found", myUser != null);
@@ -241,22 +239,22 @@
// a) @Scope(ScopeType.APPLICATION)
ScopeType scope = myUser.getScope();
assertTrue("Declared scope for myUser is Application rather than " +
scope.getLabel(), scope == ScopeType.APPLICATION);
-
+
// b) @Install(precedence=Install.FRAMEWORK)
int precedence = myUser.getPrecedence();
assertTrue("Declared precedence for myUser is 10 rather than " + precedence,
precedence == 10);
-
+
// c) @Entity
boolean isEntity = myUser.isEntity();
assertTrue("Java source for myUser is declared as entity", isEntity);
// d) @In @Out
Set<IBijectedAttribute> bijected = myUser.getBijectedAttributes();
-
+
IBijectedAttribute a1 = findBijectedAttribute(bijected, "address");
assertTrue("Attribute 'address' is not found in bijected attributes",
a1 != null);
assertTrue("Attribute 'address' is @Out annotated",
a1.isOfType(BijectedAttributeType.OUT));
-
+
IBijectedAttribute a2 = findBijectedAttribute(bijected, "payment");
assertTrue("Attribute 'payment' is not found in bijected attributes",
a2 != null);
assertTrue("Attribute 'payment' is @In annotated",
a2.isOfType(BijectedAttributeType.IN));
@@ -282,9 +280,8 @@
assertTrue("Declared factory 'myFactory2' is not found in
'myUser'", myFactory2 != null);
ISeamAnnotatedFactory af2 = (ISeamAnnotatedFactory)myFactory2;
assertTrue("Scope of 'myFactory' must be 'session'",
af2.getScope() == ScopeType.SESSION);
-
}
-
+
private IBijectedAttribute findBijectedAttribute(Set<IBijectedAttribute> bijected,
String name) {
for (IBijectedAttribute a : bijected) {
if(name.equals(a.getName())) return a;
@@ -294,10 +291,10 @@
public void testLibraryScanner() {
ISeamProject seamProject = getSeamProject();
-
+
IFile f = project.getFile("WebContent/WEB-INF/lib/jboss-seam.jar");
assertTrue("Cannot find User.java in test project", f != null &&
f.exists());
-
+
LibraryScanner scanner =(LibraryScanner)SeamCoreBuilder.createLibraryScanner();
ClassPath cp = ((SeamProject)seamProject).getClassPath();
scanner.setClassPath(cp);
@@ -308,7 +305,7 @@
ISeamFactory[] factories = null;
ISeamJavaComponentDeclaration[] componentDeclarations = null;
-
+
try {
LoadedDeclarations ds = scanner.parse(f, seamProject);
factories = ds.getFactories().toArray(new ISeamFactory[0]);
@@ -317,12 +314,12 @@
JUnitUtils.fail("Error in library scanner",e);
}
assertTrue("Factories are not found in jboss-seam.jar", factories != null
&& factories.length > 0);
-
+
// Test factory 'actor'
ISeamXmlFactory actor = (ISeamXmlFactory)find(factories, "actor");
assertTrue("Factory " + "actor" + " is not found in
jboss-seam.jar", actor != null);
assertTrue("Factory " + "actor" + " loaded wrong value",
"#{org.jboss.seam.core.actor}".equals(actor.getValue()));
-
+
try {
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
//EditorTestHelper.joinBackgroundActivities();
@@ -333,20 +330,20 @@
//After having tested details of library scanner now let us check
//that it succeeded in build.
Set<ISeamFactory> components =
seamProject.getFactoriesByName("actor");
-
+
assertTrue("Seam builder must put actor to project.", components.size()==1);
-
+
//Test components
-
+
//1. Test component declaration org.jboss.seam.core.dispatcher
-
+
ISeamJavaComponentDeclaration d =
(ISeamJavaComponentDeclaration)findDeclaration(componentDeclarations,
"org.jboss.seam.core.dispatcher");
assertTrue("Java declaration 'org.jboss.seam.core.dispatcher' is not
found", d != null);
assertTrue("Java declaration 'org.jboss.seam.core.dispatcher' must be
stateless", d.isOfType(BeanType.STATELESS));
assertTrue("Java declaration 'org.jboss.seam.core.dispatcher' must have
precedence 0", d.getPrecedence() == 0);
-
+
//2. Test component declaration org.jboss.seam.core.ejb
-
+
d = (ISeamJavaComponentDeclaration)findDeclaration(componentDeclarations,
"org.jboss.seam.core.ejb");
assertTrue("Java declaration 'org.jboss.seam.core.ejb' is not found",
d != null);
assertTrue("Java declaration 'org.jboss.seam.core.dispatcher' must have
precedence 0", d.getPrecedence() == 0);
@@ -357,48 +354,46 @@
m = find(methods, "shutdown");
assertTrue("Declared method 'shutdown' is not found in
'org.jboss.seam.core.ejb'", m != null);
assertTrue("Method 'shutdown' in 'org.jboss.seam.core.ejb' must be
destroy method", m.isOfType(SeamComponentMethodType.DESTROY));
-
+
//3. Test component declaration org.jboss.seam.core.eventContext
-
+
d = (ISeamJavaComponentDeclaration)findDeclaration(componentDeclarations,
"org.jboss.seam.core.eventContext");
assertTrue("Java declaration 'org.jboss.seam.core.eventContext' is not
found", d != null);
methods = d.getMethods();
m = find(methods, "getContext");
assertTrue("Declared method 'getContext' is not found in
'org.jboss.seam.core.eventContext'", m != null);
assertTrue("Method 'getContext' in
'org.jboss.seam.core.eventContext' must be unwrap method",
m.isOfType(SeamComponentMethodType.UNWRAP));
-
-
}
-
+
private ISeamComponentMethod find(Set<ISeamComponentMethod> methods, String name)
{
for (ISeamComponentMethod m : methods) {
if(name.equals(m.getSourceMember().getElementName())) return m;
}
return null;
}
-
+
private ISeamFactory find(ISeamFactory[] factories, String name) {
for (int i = 0; i < factories.length; i++) {
if(name.equals(factories[i].getName())) return factories[i];
}
return null;
}
-
+
/**
* This method is to cover most cases of configuring components
*/
public void testSeamProjectObjects() {
ISeamProject seamProject = getSeamProject();
-
+
//1. components.xml has entry
// <core:managed-persistence-context name="myPersistenceContext1"/>
// check that myPersistenceContext1 exists and has scope CONVERSATION
-
+
ISeamComponent c = seamProject.getComponent("myPersistenceContext1");
assertNotNull("Component myPersistenceContext1 not found.", c);
ScopeType scope = c.getScope();
assertTrue("Component myPersistenceContext1 has scope=" + (scope == null ?
null : scope.getLabel()) + ", but has to have " +
ScopeType.CONVERSATION.getLabel(), ScopeType.CONVERSATION == scope);
-
+
//2. components.xml has entry
//<core:resource-bundle>
// <core:bundle-names>
@@ -410,7 +405,7 @@
// a) component org.jboss.seam.core.resourceBundle exists,
// b) getClassName returns org.jboss.seam.core.ResourceBundle
// c) it has property bundleNames as list with two specified values.
-
+
c = seamProject.getComponent("org.jboss.seam.core.resourceBundle");
assertNotNull("Component org.jboss.seam.core.resourceBundle not found.", c);
String className = c.getClassName();
@@ -428,7 +423,7 @@
, "bundleA".equals(valueList.get(0).getValue().getValue()));
assertTrue("Second bundle name is " + valueList.get(1).getValue().getValue()
+ " rather than bundleB"
, "bundleB".equals(valueList.get(1).getValue().getValue()));
-
+
//3. components.xml has entry
// <core:manager
// conversation-is-long-running-parameter="a"
@@ -440,7 +435,7 @@
// check that
// a) component org.jboss.seam.core.manager exists,
// b) specified properties are loaded correctly
-
+
String[][] managerTestProperties = new String[][]{
{"conversationIsLongRunningParameter", "a"},
{"parentConversationIdParameter", "b"},
@@ -449,7 +444,7 @@
{"conversationTimeout", "3"}
};
scanSimpleProperties(seamProject, "org.jboss.seam.core.manager",
managerTestProperties);
-
+
//4. seam.properties has entry
//org.jboss.seam.core.microcontainer.persistenceUnitName=MyPersistenceUnit
// check that
@@ -460,21 +455,21 @@
{"persistenceUnitName", "MyPersistenceUnit"},
};
scanSimpleProperties(seamProject, "org.jboss.seam.core.microcontainer",
microcontainerTestProperties);
-
+
//5. components.xml has <component class="demo.User"/> entry
// check that
// component myUser has both java and xml declaration, the latter without name
-
+
ISeamComponent myUser = seamProject.getComponent("myUser");
assertNotNull(myUser);
Set<ISeamXmlComponentDeclaration> xml = myUser.getXmlDeclarations();
assertEquals(1, xml.size());
-
+
//6 XYZ.component.xml declares component xyz.
ISeamComponent xyz = seamProject.getComponent("xyz");
assertNotNull(xyz);
}
-
+
/**
* Tests if component componentName exists.
* Then tests if it has properties, names of which are listed by testProperties[i][0],
@@ -486,7 +481,7 @@
private void scanSimpleProperties(ISeamProject seamProject, String componentName,
String[][] testProperties) {
ISeamComponent c = seamProject.getComponent(componentName);
assertNotNull("Component " + componentName + " not found.", c);
-
+
for (int p = 0; p < testProperties.length; p++) {
String propertyName = testProperties[p][0];
String expectedValue = testProperties[p][1];
@@ -497,29 +492,27 @@
String actualValue = valueObject.getValue().getValue();
assertTrue("Property " + propertyName + " has value " +
actualValue + " rather than " + expectedValue,
expectedValue.equals(actualValue));
}
-
}
-
+
public void testInnerClass_JBIDE_1374() {
ISeamProject seamProject = getSeamProject();
ISeamComponent c = seamProject.getComponent("inner_JBIDE_1374");
assertTrue("Component inner_JBIDE_1374 declared in inner static class is not
found.", c != null);
}
-
+
public void testInnerClassInAnnotationType_JBIDE_4144() {
ISeamProject seamProject = getSeamProject();
ISeamComponent c = seamProject.getComponent("inner_JBIDE_4144");
assertTrue("Component inner_JBIDE_4144 declared in inner static class inside an
annotation type is not found.", c != null);
}
-
+
public void testInstallWithoutPrecedence_JBIDE_2052() {
ISeamProject seamProject = getSeamProject();
ISeamComponent c =
seamProject.getComponent("installWithoutPrecedence_JBIDE_2052");
// actually, exception may happen in building Seam project
assertNotNull("Component installWithoutPrecedence_JBIDE_2052 declared in class
annotated with @Install(false) is not found.", c);
-
}
-
+
public void testLocation_JBIDE_2080() {
String EJB = "org.jboss.seam.core.ejb";
ISeamProject seamProject = getSeamProject();
@@ -533,7 +526,7 @@
break;
}
}
-
+
String MY_COMPONENT = "myComponent";
assertNotNull("XML declaration for component " + MY_COMPONENT + " is not
found in components.xml.", xml);
ITextSourceReference location = xml.getLocationFor(ISeamXmlComponentDeclaration.NAME);
@@ -548,15 +541,15 @@
ISeamJavaComponentDeclaration d = c.getJavaDeclaration();
Set<ISeamContextVariable> vs = d.getVariablesByName("Hare");
assertTrue("Cannot find Hare among all animals, import 'animal.wild' is
ignored", vs != null && !vs.isEmpty());
-
+
vs = d.getVariablesByName("Rabbit");
assertTrue("Cannot find Rabbit among all animals, import 'animal.tame' is
ignored", vs != null && !vs.isEmpty());
-
+
c = seamProject.getComponent("animals.wild");
d = c.getJavaDeclaration();
vs = d.getVariablesByName("Hare");
assertTrue("Cannot find Hare among wild animals, import 'animal.wild' is
ignored", vs != null && !vs.isEmpty());
-
+
vs = d.getVariablesByName("Rabbit");
assertFalse("Foundd Rabbit among wild animals, import 'animal.tame' is
illegally added", vs != null && !vs.isEmpty());
}
@@ -567,4 +560,4 @@
provider.dispose();
}
}
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/Seam2ValidatorTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/Seam2ValidatorTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/Seam2ValidatorTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -17,9 +17,7 @@
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.jboss.tools.seam.core.test.validation.SeamCoreValidatorWrapper;
import org.jboss.tools.seam.internal.core.validation.SeamValidationMessages;
-import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
/**
@@ -29,7 +27,7 @@
IProject projectEAR = null;
IProject projectWAR = null;
IProject projectEJB = null;
-
+
ProjectImportTestSetup setup;
@Override
@@ -39,9 +37,9 @@
projectEJB = projects[0];
projectEAR = projects[1];
projectWAR = projects[2];
+ projectEAR.build(IncrementalProjectBuilder.FULL_BUILD, null);
projectEJB.build(IncrementalProjectBuilder.FULL_BUILD, null);
projectWAR.build(IncrementalProjectBuilder.FULL_BUILD, null);
- JobUtils.waitForIdle();
setProject(projectEJB);
}
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -55,6 +55,7 @@
IProject project;
TestProjectProvider provider;
+ @Override
protected void setUp() throws Exception {
provider = new TestProjectProvider(BUNDLE,"/projects/bigProject" ,
"bigProject", true);
project = provider.getProject();
@@ -62,7 +63,6 @@
File template = getTemplateFile();
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- JobUtils.waitForIdle();
SeamBigProjectGenerator g = new SeamBigProjectGenerator();
g.generate(folder, template);
@@ -72,7 +72,7 @@
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
}
-
+
private File getTemplateFile() {
Bundle bundle = Platform.getBundle(BUNDLE);
URL url = null;
@@ -84,7 +84,7 @@
String location = url.getFile();
return new File(location);
}
-
+
public void testBigProject() throws IOException {
ISeamProject sp = getSeamProject();
ISeamComponent[] cs = sp.getComponents();
@@ -113,11 +113,10 @@
+ "of seam model loading than in the beginning.\n"
+ "That implies that time depends as N*N on the number of components N.");
}
-
+
generateLongXHTML(cs);
}
-
private ISeamProject getSeamProject() {
ISeamProject seamProject = null;
try {
@@ -128,19 +127,18 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
+
@Override
protected void tearDown() throws Exception {
ISeamProject sp = getSeamProject();
SeamProject impl = (SeamProject)sp;
if(impl != null) impl.clearStorage();
- JobUtils.waitForIdle();
provider.dispose();
}
private void generateLongXHTML(ISeamComponent[] cs) {
StringBuffer sb = new StringBuffer();
-
+
IFolder webContent = project.getFolder("WebContent");
IFile tmpl = webContent.getFile("login.xhtml");
String s = FileUtil.readFile(tmpl.getLocation().toFile());
@@ -157,7 +155,7 @@
"value=\"#{" + n + ".value}\"/>\n";
sb.append(q);
}
-
+
sb.append(s.substring(j));
IFile file = webContent.getFile("long.xhtml");
try {
@@ -168,7 +166,7 @@
JobUtils.waitForIdle();
long dt = System.currentTimeMillis() - time;
System.out.println("validated in " + dt);
-
+
// ResourcesUtils.setBuildAutomatically(save);
assertTrue("Validator takes more than 5s (" + ((dt-500)/1000d) + ") for
validating generated long.xhtml", ((dt-500)/1000d) < 5);
@@ -176,5 +174,4 @@
JUnitUtils.fail("", e);
}
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -13,6 +13,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -20,6 +21,7 @@
import org.jboss.tools.seam.core.test.project.facet.SeamRuntimeListConverterTest;
import org.jboss.tools.seam.core.test.project.facet.SeamRuntimeManagerTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
+import org.jboss.tools.test.util.ResourcesUtils;
/**
* @author V.Kabanovich
@@ -28,11 +30,12 @@
public class SeamCoreAllTests {
public static final String PLUGIN_ID = SeamCorePlugin.PLUGIN_ID;
//
- public static Test suite() {
+ public static Test suite() throws CoreException {
// it can be done here because it is not needed to be enabled back
JavaModelManager.getIndexManager().disable();
JSPSearchSupport.getInstance().setCanceled(true);
-
+ ResourcesUtils.setBuildAutomatically(false);
+
TestSuite suite = new TestSuite();
suite.setName("All tests for " + PLUGIN_ID);
suite.addTest(new ProjectImportTestSetup(new
TestSuite(ScannerTest.class),"org.jboss.tools.seam.core.test","projects/TestScanner","TestScanner"));
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -28,7 +28,6 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -40,10 +39,10 @@
IProject projectEAR = null;
IProject projectWAR = null;
IProject projectEJB = null;
-
+
boolean makeCopy = true;
ProjectImportTestSetup setup;
-
+
public SeamEARTest() {}
protected void setUp() throws Exception {
@@ -55,15 +54,15 @@
projectEJB = projects[2];
projectWAR = projects[0];
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
- JobUtils.waitForIdle();
+ projectEAR.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ projectEJB.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ projectWAR.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
private ISeamProject getSeamProject(IProject project) throws CoreException {
-
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
ISeamProject seamProject = null;
-
+
/*
* SeamCorePlugin.getSeamProject(IProject project, boolean resolve);
* is used to load Seam Project properly.
@@ -76,16 +75,15 @@
assertNotNull("Seam project is null", seamProject);
return seamProject;
}
-
+
public void testEarProject() throws CoreException {
ISeamProject seamProject = getSeamProject(projectWAR);
ISeamComponent c = seamProject.getComponent("authenticator");
assertNotNull("War project must see component 'authenticator' declared in
ejb project", c);
-
+
c = seamProject.getComponent("org.jboss.seam.core.interpolator");
assertNotNull("War project must see component
'org.jboss.seam.core.interpolator' declared in ejb project", c);
-
}
/**
@@ -99,31 +97,27 @@
ISeamComponent c = seamProject.getComponent("authenticator");
assertNotNull("War project must see component 'authenticator' declared in
ejb project", c);
-
+
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
-
- JobUtils.waitForIdle();
projectWAR.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
-
+
c = seamProject.getComponent("authenticator");
assertNull("War project must see component 'authenticator' declared in ejb
project", c);
projectWAR.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
+
c = seamProject.getComponent("authenticator");
assertNotNull("War project must see component 'authenticator' declared in
ejb project", c);
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
-
}
-
+ @Override
protected void tearDown() throws Exception {
setup.deleteProjects();
}
-
+
private static IRuntime createRuntime(String runtimeName) throws CoreException {
IRuntimeWorkingCopy runtime = null;
String type = null;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamModelStorageTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamModelStorageTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamModelStorageTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -4,14 +4,11 @@
import org.eclipse.core.resources.IFile;
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.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.jst.web.kb.KbProjectFactory;
-import org.jboss.tools.jst.web.kb.internal.KbProject;
-import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
+import org.jboss.tools.seam.core.SeamCoreBuilder;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JobUtils;
@@ -26,16 +23,15 @@
super("Seam Model Storage Test");
}
+ @Override
public void setUp() throws Exception {
project =
ResourcesPlugin.getWorkspace().getRoot().getProject("TestStorage");
assertNotNull("Can't load TestStorage", project); //$NON-NLS-1$
if(!project.exists()) {
- provider = new TestProjectProvider("org.jboss.tools.seam.core.test",
- null,"TestScanner" ,true);
+ provider = new TestProjectProvider("org.jboss.tools.seam.core.test", null,
"TestScanner", true);
project = provider.getProject();
}
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
}
public void testStorage() throws Exception {
@@ -44,35 +40,33 @@
int mod = seam.getModificationsSinceLastStore();
System.out.println("-->" + mod);
assertTrue("Modification index after load must be greater than 0", mod >
0);
-
+
seam.store();
mod = seam.getModificationsSinceLastStore();
System.out.println("-->" + mod);
assertEquals("Modification index after store must be cleared", 0, mod);
-
- IFile fromFile = project.getFile(new
Path("WebContent/WEB-INF/lib/jboss-seam.1"));
- IFile toFile = project.getFile(new
Path("WebContent/WEB-INF/lib/jboss-seam.jar"));
-
- toFile.create(fromFile.getContents(), true, new NullProgressMonitor());
+
+ SeamProject seamProject = (SeamProject)SeamCorePlugin.getSeamProject(project, true);
+ seamProject.setStoreDisabledForTesting(true);
+
try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ IFile fromFile = project.getFile(new
Path("WebContent/WEB-INF/lib/jboss-seam.1"));
+ IFile toFile = project.getFile(new
Path("WebContent/WEB-INF/lib/jboss-seam.jar"));
+
+ toFile.create(fromFile.getContents(), true, new NullProgressMonitor());
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
NullProgressMonitor());
+
+ System.out.println("-->" + mod);
+ // Thread.sleep(1000);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, SeamCoreBuilder.BUILDER_ID, null,
new NullProgressMonitor());
+ JobUtils.waitForIdle();
+
+ mod = seam.getModificationsSinceLastStore();
+ System.out.println("-->" + mod);
+ assertTrue("Modification index after adding new library must be greater than
0", mod > 0);
+ } finally {
+ seamProject.setStoreDisabledForTesting(false);
}
- JobUtils.waitForIdle();
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- JobUtils.waitForIdle();
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
-
- mod = seam.getModificationsSinceLastStore();
- System.out.println("-->" + mod);
- assertTrue("Modification index after adding new library must be greater than
0", mod > 0);
}
@Override
@@ -81,5 +75,4 @@
provider.dispose();
}
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsAllTests.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -15,8 +15,10 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
+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.jdt.internal.core.JavaModelManager;
import org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport;
import org.eclipse.wst.validation.ValidationFramework;
@@ -49,6 +51,7 @@
JUnitUtils.fail("Cannot configure seam nature.", e);
}
ResourcesUtils.setBuildAutomatically(false);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
protected void tearDown() throws Exception {
ResourcesUtils.setBuildAutomatically(true);
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -23,6 +23,7 @@
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.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -44,7 +45,6 @@
import org.jboss.tools.seam.internal.core.validation.SeamValidationErrorManager;
import org.jboss.tools.seam.internal.core.validation.SeamValidationMessages;
import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
import org.jboss.tools.tests.IMarkerFilter;
@@ -66,24 +66,17 @@
assertTrue(newContentFile.exists());
super.copyContentsFile(originalFile, newContentFile);
if("xml".equalsIgnoreCase(originalFile.getFileExtension())) {
- // Workaroud for an issue in XModel. If we change a XML to fast then its timestamp may
not be changed. So XModel may not load the changed file.
+ // Workaroud for an issue in XModel. If we change a XML too fast then its timestamp
may not be changed. So XModel may not load the changed file.
originalFile.setLocalTimeStamp(originalFile.getModificationStamp() + 3000);
}
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
@Override
protected void setUp() throws Exception {
project =
ResourcesPlugin.getWorkspace().getRoot().getProject("SeamWebWarTestProject");
- if(!project.exists()) {
- ProjectImportTestSetup setup = new ProjectImportTestSetup(
- this,
- "org.jboss.tools.seam.core.test",
- "projects/SeamWebWarTestProject",
- "SeamWebWarTestProject");
- project = setup.importProject();
- }
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ assertTrue(project.exists());
}
@Override
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -32,18 +32,20 @@
public class SerializationTest extends TestCase {
IProject project = null;
boolean makeCopy = true;
-
+
public SerializationTest() {
super("Seam Serialization test");
}
+ @Override
protected void setUp() throws Exception {
project = ResourcesUtils.importProject(
"org.jboss.tools.seam.core.test","/projects/TestScanner" , new
NullProgressMonitor());
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
}
+ @Override
protected void tearDown() throws Exception {
if(project != null && project.isAccessible()) {
project.delete(false, true, new NullProgressMonitor());
@@ -131,15 +133,12 @@
try {
boolean auto = ResourcesUtils.setBuildAutomatically(false);
sp.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
- JobUtils.waitForIdle();
int components_1 = sp.getComponents().length;
assertFalse(components_1 == 0);
sp.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, null);
- JobUtils.waitForIdle();
int components_2 = sp.getComponents().length;
assertEquals(components_2, 0);
sp.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
- JobUtils.waitForIdle();
int components_3 = sp.getComponents().length;
assertEquals(components_1, components_3);
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamFacetOnExistingProjectTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -13,6 +13,7 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -25,7 +26,6 @@
import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
-import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
/**
@@ -39,7 +39,7 @@
@Override
protected void setUp() throws Exception {
project = ResourcesUtils.importProject("org.jboss.tools.seam.core.test",
"projects/jsf");
- JobUtils.waitForIdle();
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
IFacetedProject fproj = ProjectFacetsManager.create(project);
@@ -47,7 +47,7 @@
IProjectFacetVersion seamFacetVersion = seamFacet.getVersion("2.0");
fproj.installProjectFacet(seamFacetVersion, createSeamDataModel(), null);
- JobUtils.waitForIdle();
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
seamProject = SeamCorePlugin.getSeamProject(project, false);
}
@@ -55,7 +55,6 @@
@Override
protected void tearDown() throws Exception {
ResourcesUtils.deleteProject(project.getName());
- JobUtils.waitForIdle();
}
//
https://issues.jboss.org/browse/JBIDE-9183
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -96,4 +96,4 @@
return 1;
}
}
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeManagerTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeManagerTest.java 2012-03-01
01:39:57 UTC (rev 39212)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeManagerTest.java 2012-03-01
02:16:54 UTC (rev 39213)
@@ -14,6 +14,8 @@
import java.io.IOException;
import java.net.URL;
+import junit.framework.TestCase;
+
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.seam.core.SeamUtil;
@@ -22,8 +24,6 @@
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.osgi.framework.Bundle;
-import junit.framework.TestCase;
-
/**
* @author eskimo
*
@@ -96,20 +96,6 @@
}
/**
- * Test method for {@link
org.jboss.tools.seam.core.project.facet.SeamRuntimeManager#removeRuntime(org.jboss.tools.seam.core.project.facet.SeamRuntime)}.
- */
-// public void testRemoveRuntime() {
-// fail("Not yet implemented");
-// }
-
- /**
- * Test method for {@link
org.jboss.tools.seam.core.project.facet.SeamRuntimeManager#getRuntimeForProject(org.eclipse.core.resources.IProject)}.
- */
-// public void testGetRuntimeForProject() {
-//
-// }
-
- /**
* Test method for {@link
org.jboss.tools.seam.core.project.facet.SeamRuntimeManager#getDefaultRuntime()}.
*/
public void testGetDefaultRuntime() {