This commit was manufactured by cvs2svn to create tag 'v200607070001'.
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath b/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath
deleted file mode 100644
index 751c8f2..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/.project b/tests/org.eclipse.wst.common.project.facet.core.tests/.project
deleted file mode 100644
index 34d80fc..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.common.project.facet.core.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 32d1602..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Facet Core Tests Plug-in
-Bundle-SymbolicName: org.eclipse.wst.common.project.facet.core.tests;singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Localization: plugin
-Require-Bundle: org.junit,
- org.eclipse.wst.common.project.facet.core,
- org.eclipse.core.runtime,
- org.eclipse.core.resources
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties b/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties
deleted file mode 100644
index e9863e2..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml b/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml
deleted file mode 100644
index 710cc2d..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/plugin.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-
-<plugin>
-
- <extension point="org.eclipse.wst.common.project.facet.core.facets">
-
- <category id="cat1">
- <label>Category 1</label>
- <description>This is the category description.</description>
- </category>
-
- <project-facet id="facet1">
- <label>Facet 1</label>
- <description>This is the description of facet1.</description>
- </project-facet>
-
- <project-facet-version facet="facet1" version="1.0">
- <action type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
- <action type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
- <action type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="facet1" version="1.2">
- <action type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
- <action type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
- <action type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
- </project-facet-version>
-
- <project-facet-version facet="facet1" version="1.2.1"/>
- <project-facet-version facet="facet1" version="1.3"/>
- <project-facet-version facet="facet1" version="2.0"/>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1InstallDelegate"/>
- </action>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1UninstallDelegate"/>
- </action>
-
- <action facet="facet1" version="[1.2.1-2.0]" type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet1VersionChangeDelegate"/>
- </action>
-
- <project-facet id="facet2">
- <version-comparator class="org.eclipse.wst.common.project.facet.core.tests.support.CustomVersionComparator"/>
- <category>cat1</category>
- </project-facet>
-
- <project-facet-version facet="facet2" version="3.5">
- <constraint>
- <requires facet="facet1" version="1.0"/>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="3.5#a">
- <constraint>
- <and>
- <requires facet="facet1" version="[1.2-1.3)"/>
- </and>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7">
- <constraint>
- <or>
- <requires facet="facet1" version="[1.3"/>
- </or>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7#b">
- <constraint>
- <or>
- <requires facet="facet1" version="1.3"/>
- <requires facet="facet1" version="2.0"/>
- </or>
- </constraint>
- </project-facet-version>
-
- <project-facet-version facet="facet2" version="4.7#c">
- <constraint>
- <and>
- <or>
- <requires facet="facet1" version="1.2.1"/>
- <requires facet="facet1" version="1.3"/>
- <requires facet="facet1" version="2.0"/>
- </or>
- <conflicts facet="facet3a"/>
- <conflicts facet="facet3b" version="1.0"/>
- <conflicts group="group1"/>
- </and>
- </constraint>
- <group-member id="group1"/>
- </project-facet-version>
-
- <project-facet id="facet2ext">
- <category>cat1</category>
- </project-facet>
-
- <project-facet-version facet="facet2ext" version="1.0"/>
-
- <category id="cat2"/>
-
- <project-facet id="facet3a">
- <category>cat2</category>
- </project-facet>
-
- <project-facet-version facet="facet3a" version="1.0"/>
- <project-facet-version facet="facet3a" version="2.0"/>
-
- <action facet="facet3a" version="[1.0-2.0]" type="install">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aInstallDelegate"/>
- </action>
-
- <action facet="facet3a" version="[1.0-2.0]" type="uninstall">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aUninstallDelegate"/>
- </action>
-
- <action facet="facet3a" version="[1.0-2.0]" type="version-change">
- <delegate class="org.eclipse.wst.common.project.facet.core.tests.support.Facet3aVersionChangeDelegate"/>
- </action>
-
- <project-facet id="facet3b">
- <category>cat2</category>
- </project-facet>
-
- <project-facet-version facet="facet3b" version="1.0"/>
- <project-facet-version facet="facet3b" version="2.0"/>
-
- <project-facet id="facet3c">
- <category>cat2</category>
- </project-facet>
-
- <project-facet-version facet="facet3c" version="1.0">
- <group-member id="group1"/>
- </project-facet-version>
-
- <project-facet-version facet="facet3c" version="2.0">
- <group-member id="group1"/>
- </project-facet-version>
-
- <preset id="preset1">
- <label>Preset 1</label>
- <description>This is the description for the first preset.</description>
- <facet id="facet1" version="2.0"/>
- <facet id="facet2" version="3.5#a"/>
- <facet id="facet2ext" version="1.0"/>
- </preset>
-
- <preset id="preset2">
- <facet id="facet3a" version="1.0"/>
- <facet id="facet3b" version="1.0"/>
- <facet id="facet3c" version="1.0"/>
- </preset>
-
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java
deleted file mode 100644
index 7e6bf00..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AbstractTests.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import junit.framework.TestCase;
-
-public abstract class AbstractTests
-
- extends TestCase
-
-{
- protected static final IWorkspace ws = ResourcesPlugin.getWorkspace();
- protected final Set resourcesToCleanup = new HashSet();
-
- protected AbstractTests( final String name )
- {
- super( name );
- }
-
- protected void tearDown()
-
- throws CoreException
-
- {
- for( Iterator itr = this.resourcesToCleanup.iterator(); itr.hasNext(); )
- {
- final IResource r = (IResource) itr.next();
- r.delete( true, null );
- }
- }
-
- protected void addResourceToCleanup( final IResource resource )
- {
- this.resourcesToCleanup.add( resource );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java
deleted file mode 100644
index 9421a00..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/AllTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class AllTests
-
- extends TestCase
-
-{
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "All Faceted Project Framework Tests" );
-
- suite.addTest( BasicTests.suite() );
- suite.addTest( ProjectCreationTests.suite() );
- suite.addTest( BasicFacetActionTests.suite() );
- suite.addTest( FacetActionSortTests.suite() );
- suite.addTest( ProjectChangeReactionTests.suite() );
-
- return suite;
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java
deleted file mode 100644
index c4a0066..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicFacetActionTests.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-
-public class BasicFacetActionTests
-
- extends TestCase
-
-{
- private static final String TEST_PROJECT_NAME = "testProject";
- private static final IWorkspace ws = ResourcesPlugin.getWorkspace();
-
- private static final IFile facet1ArtifactFile
- = ws.getRoot().getProject( TEST_PROJECT_NAME ).getFile( "facet1.txt" );
-
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private IFacetedProject fpj;
-
- private BasicFacetActionTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Basic Facet Action Tests" );
-
- suite.addTest( new BasicFacetActionTests( "testFacetInstall1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetInstall2" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetInstall3" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall2" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetUninstall3" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetVersionChange1" ) );
- suite.addTest( new BasicFacetActionTests( "testFacetVersionChange2" ) );
- suite.addTest( new BasicFacetActionTests( "testActionSeries" ) );
-
- return suite;
- }
-
- protected void setUp()
-
- throws CoreException
-
- {
- assertFalse( ws.getRoot().getProject( TEST_PROJECT_NAME ).exists() );
- this.fpj = ProjectFacetsManager.create( TEST_PROJECT_NAME, null, null );
- assertTrue( fpj.getProject().exists() );
- }
-
- protected void tearDown()
-
- throws CoreException
-
- {
- this.fpj.getProject().delete( true, null );
- }
-
- public void testFacetInstall1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
- }
-
- public void testFacetInstall2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v121, null, null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
- }
-
- public void testFacetInstall3()
-
- throws CoreException, IOException
-
- {
- final Action action = new Action( Action.Type.INSTALL, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
- }
-
- public void testFacetUninstall1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- this.fpj.uninstallProjectFacet( f1v10, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetUninstall2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v121, null, null );
- this.fpj.uninstallProjectFacet( f1v121, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetUninstall3()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v20, null, null );
- this.fpj.uninstallProjectFacet( f1v20, null, null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
- public void testFacetVersionChange1()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v10, null, null );
- final Action action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
- }
-
- public void testFacetVersionChange2()
-
- throws CoreException, IOException
-
- {
- this.fpj.installProjectFacet( f1v13, null, null );
- final Action action = new Action( Action.Type.VERSION_CHANGE, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
- }
-
- public void testActionSeries()
-
- throws CoreException, IOException
-
- {
- Action action;
-
- action = new Action( Action.Type.INSTALL, f1v10, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v13, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v13.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
-
- action = new Action( Action.Type.UNINSTALL, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- assertFalse( facet1ArtifactFile.exists() );
-
- action = new Action( Action.Type.INSTALL, f1v12, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v12.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v13, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v13.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v10, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v10.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v20, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v20.getVersionString() );
-
- action = new Action( Action.Type.VERSION_CHANGE, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- TestUtils.assertEquals( facet1ArtifactFile, f1v121.getVersionString() );
-
- action = new Action( Action.Type.UNINSTALL, f1v121, null );
- this.fpj.modify( Collections.singleton( action ), null );
- assertFalse( facet1ArtifactFile.exists() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java
deleted file mode 100644
index 2ea3076..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/BasicTests.java
+++ /dev/null
@@ -1,715 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.ICategory;
-import org.eclipse.wst.common.project.facet.core.IConstraint;
-import org.eclipse.wst.common.project.facet.core.IGroup;
-import org.eclipse.wst.common.project.facet.core.IPreset;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public final class BasicTests
-
- extends TestCase
-
-{
- private static final String PLUGIN_ID
- = "org.eclipse.wst.common.project.facet.core.tests";
-
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- private static IProjectFacet f2;
- private static IProjectFacetVersion f2v35;
- private static IProjectFacetVersion f2v35a;
- private static IProjectFacetVersion f2v47;
- private static IProjectFacetVersion f2v47b;
- private static IProjectFacetVersion f2v47c;
-
- private static IProjectFacet f2ext;
- private static IProjectFacetVersion f2extv10;
-
- private static IProjectFacet f3a;
- private static IProjectFacetVersion f3av10;
- private static IProjectFacetVersion f3av20;
-
- private static IProjectFacet f3b;
- private static IProjectFacetVersion f3bv10;
- private static IProjectFacetVersion f3bv20;
-
- private static IProjectFacet f3c;
- private static IProjectFacetVersion f3cv10;
- private static IProjectFacetVersion f3cv20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- f2v35 = f2.getVersion( "3.5" );
- f2v35a = f2.getVersion( "3.5#a" );
- f2v47 = f2.getVersion( "4.7" );
- f2v47b = f2.getVersion( "4.7#b" );
- f2v47c = f2.getVersion( "4.7#c" );
-
- f2ext = ProjectFacetsManager.getProjectFacet( "facet2ext" );
- f2extv10 = f2ext.getVersion( "1.0" );
-
- f3a = ProjectFacetsManager.getProjectFacet( "facet3a" );
- f3av10 = f3a.getVersion( "1.0" );
- f3av20 = f3a.getVersion( "2.0" );
-
- f3b = ProjectFacetsManager.getProjectFacet( "facet3b" );
- f3bv10 = f3b.getVersion( "1.0" );
- f3bv20 = f3b.getVersion( "2.0" );
-
- f3c = ProjectFacetsManager.getProjectFacet( "facet3c" );
- f3cv10 = f3c.getVersion( "1.0" );
- f3cv20 = f3c.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private BasicTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Basic Tests" );
-
- suite.addTest( new BasicTests( "testProjectFacetExtensionPoint" ) );
- suite.addTest( new BasicTests( "testProjectFacetVersionExtensionPoint" ) );
- suite.addTest( new BasicTests( "testCategoryExtensionPoint" ) );
- suite.addTest( new BasicTests( "testPresetExtensionPoint" ) );
- suite.addTest( new BasicTests( "testDefaultVersionComparator" ) );
- suite.addTest( new BasicTests( "testCustomVersionComparator" ) );
- suite.addTest( new BasicTests( "testVersionExpressions" ) );
- suite.addTest( new BasicTests( "testConstraints" ) );
- suite.addTest( new BasicTests( "testConstraintApi" ) );
-
- return suite;
- }
-
- public void testProjectFacetExtensionPoint()
- {
- assertTrue( ProjectFacetsManager.isProjectFacetDefined( "facet1" ) );
- final IProjectFacet f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- assertTrue( ProjectFacetsManager.getProjectFacets().contains( f1 ) );
-
- assertEquals( f1.getId(), "facet1" );
- assertEquals( f1.getLabel(), "Facet 1" );
- assertEquals( f1.getDescription(), "This is the description of facet1." );
- assertEquals( f1.getPluginId(), PLUGIN_ID );
-
- assertTrue( ProjectFacetsManager.isProjectFacetDefined( "facet2" ) );
- final IProjectFacet f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- assertTrue( ProjectFacetsManager.getProjectFacets().contains( f2 ) );
-
- assertEquals( f2.getId(), "facet2" );
- assertEquals( f2.getLabel(), "facet2" );
- assertEquals( f2.getDescription(), "" );
- assertEquals( f2.getPluginId(), PLUGIN_ID );
- }
-
- public void testProjectFacetVersionExtensionPoint()
- {
- assertTrue( f1.hasVersion( "1.0" ) );
- final IProjectFacetVersion f1v10 = f1.getVersion( "1.0" );
- assertEquals( f1v10.getVersionString(), "1.0" );
- assertEquals( f1v10.getProjectFacet(), f1 );
- assertEquals( f1v10.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.2" ) );
- final IProjectFacetVersion f1v12 = f1.getVersion( "1.2" );
- assertEquals( f1v12.getVersionString(), "1.2" );
- assertEquals( f1v12.getProjectFacet(), f1 );
- assertEquals( f1v12.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.2.1" ) );
- final IProjectFacetVersion f1v121 = f1.getVersion( "1.2.1" );
- assertEquals( f1v121.getVersionString(), "1.2.1" );
- assertEquals( f1v121.getProjectFacet(), f1 );
- assertEquals( f1v121.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "1.3" ) );
- final IProjectFacetVersion f1v13 = f1.getVersion( "1.3" );
- assertEquals( f1v13.getVersionString(), "1.3" );
- assertEquals( f1v13.getProjectFacet(), f1 );
- assertEquals( f1v13.getPluginId(), PLUGIN_ID );
-
- assertTrue( f1.hasVersion( "2.0" ) );
- final IProjectFacetVersion f1v20 = f1.getVersion( "2.0" );
- assertEquals( f1v20.getVersionString(), "2.0" );
- assertEquals( f1v20.getProjectFacet(), f1 );
- assertEquals( f1v20.getPluginId(), PLUGIN_ID );
-
- assertEquals( f1.getVersions(),
- asSet( f1v10, f1v12, f1v121, f1v13, f1v20 ) );
-
- assertTrue( f2.hasVersion( "3.5" ) );
- final IProjectFacetVersion f2v35 = f2.getVersion( "3.5" );
- assertEquals( f2v35.getVersionString(), "3.5" );
- assertEquals( f2v35.getProjectFacet(), f2 );
- assertEquals( f2v35.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "3.5#a" ) );
- final IProjectFacetVersion f2v35a = f2.getVersion( "3.5#a" );
- assertEquals( f2v35a.getVersionString(), "3.5#a" );
- assertEquals( f2v35a.getProjectFacet(), f2 );
- assertEquals( f2v35a.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7" ) );
- final IProjectFacetVersion f2v47 = f2.getVersion( "4.7" );
- assertEquals( f2v47.getVersionString(), "4.7" );
- assertEquals( f2v47.getProjectFacet(), f2 );
- assertEquals( f2v47.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7#b" ) );
- final IProjectFacetVersion f2v47b = f2.getVersion( "4.7#b" );
- assertEquals( f2v47b.getVersionString(), "4.7#b" );
- assertEquals( f2v47b.getProjectFacet(), f2 );
- assertEquals( f2v47b.getPluginId(), PLUGIN_ID );
-
- assertTrue( f2.hasVersion( "4.7#c" ) );
- final IProjectFacetVersion f2v47c = f2.getVersion( "4.7#c" );
- assertEquals( f2v47c.getVersionString(), "4.7#c" );
- assertEquals( f2v47c.getProjectFacet(), f2 );
- assertEquals( f2v47c.getPluginId(), PLUGIN_ID );
-
- assertEquals( f2.getVersions(),
- asSet( f2v35, f2v35a, f2v47, f2v47b, f2v47c ) );
-
- // Check for version that doesn't exist.
-
- assertFalse( f2.hasVersion( "6.9" ) );
-
- try
- {
- f2.getVersion( "6.9" );
- fail();
- }
- catch( IllegalArgumentException e ) {}
- }
-
- public void testCategoryExtensionPoint()
- {
- assertTrue( ProjectFacetsManager.isCategoryDefined( "cat1" ) );
- final ICategory cat1 = ProjectFacetsManager.getCategory( "cat1" );
- assertTrue( ProjectFacetsManager.getCategories().contains( cat1 ) );
-
- assertEquals( cat1.getId(), "cat1" );
- assertEquals( cat1.getLabel(), "Category 1" );
- assertEquals( cat1.getDescription(), "This is the category description." );
- assertEquals( cat1.getPluginId(), PLUGIN_ID );
-
- assertEquals( cat1.getProjectFacets(), asSet( f2, f2ext ) );
- assertEquals( f2.getCategory(), cat1 );
- assertEquals( f2ext.getCategory(), cat1 );
-
- assertTrue( ProjectFacetsManager.isCategoryDefined( "cat2" ) );
- final ICategory cat2 = ProjectFacetsManager.getCategory( "cat2" );
- assertTrue( ProjectFacetsManager.getCategories().contains( cat2 ) );
-
- assertEquals( cat2.getId(), "cat2" );
- assertEquals( cat2.getLabel(), "cat2" );
- assertEquals( cat2.getDescription(), "" );
- assertEquals( cat2.getPluginId(), PLUGIN_ID );
-
- assertEquals( cat2.getProjectFacets(), asSet( f3a, f3b, f3c ) );
- assertEquals( f3a.getCategory(), cat2 );
- assertEquals( f3b.getCategory(), cat2 );
- assertEquals( f3c.getCategory(), cat2 );
- }
-
- public void testPresetExtensionPoint()
- {
- assertTrue( ProjectFacetsManager.isPresetDefined( "preset1" ) );
- final IPreset preset1 = ProjectFacetsManager.getPreset( "preset1" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset1 ) );
-
- assertEquals( preset1.getId(), "preset1" );
- assertEquals( preset1.getLabel(), "Preset 1" );
- assertEquals( preset1.getDescription(), "This is the description for the first preset." );
- assertEquals( preset1.getProjectFacets(), asSet( f1v20, f2v35a, f2extv10 ) );
- assertFalse( preset1.isUserDefined() );
-
- assertTrue( ProjectFacetsManager.isPresetDefined( "preset2" ) );
- final IPreset preset2 = ProjectFacetsManager.getPreset( "preset2" );
- assertTrue( ProjectFacetsManager.getPresets().contains( preset2 ) );
-
- assertEquals( preset2.getId(), "preset2" );
- assertEquals( preset2.getLabel(), "preset2" );
- assertEquals( preset2.getDescription(), "" );
- assertEquals( preset2.getProjectFacets(), asSet( f3av10, f3bv10, f3cv10 ) );
- assertFalse( preset2.isUserDefined() );
- }
-
- public void testDefaultVersionComparator()
-
- throws CoreException
-
- {
- final Comparator comp = f1.getVersionComparator();
-
- assertEquals( comp.getClass().getName(),
- "org.eclipse.wst.common.project.facet.core.DefaultVersionComparator" );
-
- assertTrue( comp.compare( "1.0", "1.2" ) < 0 );
- assertTrue( comp.compare( "1.2", "1.2.1" ) < 0 );
- assertTrue( comp.compare( "1.2.1", "2.0" ) < 0 );
-
- assertTrue( comp.compare( "1.2", "1.0" ) > 0 );
- assertTrue( comp.compare( "1.2.1", "1.2" ) > 0 );
- assertTrue( comp.compare( "2.0", "1.2.1" ) > 0 );
-
- assertTrue( comp.compare( "1.0", "1.0" ) == 0 );
- assertTrue( comp.compare( "1.2", "1.2" ) == 0 );
- assertTrue( comp.compare( "1.2.1", "1.2.1" ) == 0 );
- assertTrue( comp.compare( "2.0", "2.0" ) == 0 );
-
- assertEquals( f1.getLatestVersion(), f1v20 );
-
- final List asc = f1.getSortedVersions( true );
-
- assertEquals( asc.size(), 5 );
- assertEquals( asc.get( 0 ), f1v10 );
- assertEquals( asc.get( 1 ), f1v12 );
- assertEquals( asc.get( 2 ), f1v121 );
- assertEquals( asc.get( 3 ), f1v13 );
- assertEquals( asc.get( 4 ), f1v20 );
-
- final List desc = f1.getSortedVersions( false );
-
- assertEquals( desc.size(), 5 );
- assertEquals( desc.get( 0 ), f1v20 );
- assertEquals( desc.get( 1 ), f1v13 );
- assertEquals( desc.get( 2 ), f1v121 );
- assertEquals( desc.get( 3 ), f1v12 );
- assertEquals( desc.get( 4 ), f1v10 );
- }
-
- public void testCustomVersionComparator()
-
- throws CoreException
-
- {
- final Comparator comp = f2.getVersionComparator();
-
- assertEquals( comp.getClass().getName(),
- "org.eclipse.wst.common.project.facet.core.tests.support.CustomVersionComparator" );
-
- assertTrue( comp.compare( "3.5", "4.7" ) < 0 );
- assertTrue( comp.compare( "3.5", "3.5#a" ) < 0 );
- assertTrue( comp.compare( "4.7#c", "4.7#b" ) < 0 );
-
- assertTrue( comp.compare( "4.7", "3.5" ) > 0 );
- assertTrue( comp.compare( "3.5#a", "3.5" ) > 0 );
- assertTrue( comp.compare( "4.7#b", "4.7#c" ) > 0 );
-
- assertTrue( comp.compare( "3.5", "3.5" ) == 0 );
- assertTrue( comp.compare( "3.5#a", "3.5#a" ) == 0 );
- assertTrue( comp.compare( "4.7", "4.7" ) == 0 );
- assertTrue( comp.compare( "4.7#b", "4.7#b" ) == 0 );
-
- assertEquals( f2.getLatestVersion(), f2v47b );
-
- final List asc = f2.getSortedVersions( true );
-
- assertEquals( asc.size(), 5 );
- assertEquals( asc.get( 0 ), f2v35 );
- assertEquals( asc.get( 1 ), f2v35a );
- assertEquals( asc.get( 2 ), f2v47 );
- assertEquals( asc.get( 3 ), f2v47c );
- assertEquals( asc.get( 4 ), f2v47b );
-
- final List desc = f2.getSortedVersions( false );
-
- assertEquals( desc.size(), 5 );
- assertEquals( desc.get( 0 ), f2v47b );
- assertEquals( desc.get( 1 ), f2v47c );
- assertEquals( desc.get( 2 ), f2v47 );
- assertEquals( desc.get( 3 ), f2v35a );
- assertEquals( desc.get( 4 ), f2v35 );
- }
-
- public void testVersionExpressions()
-
- throws CoreException
-
- {
- assertEquals( f1.getVersions( "1.2" ),
- asSet( f1v12 ) );
-
- assertEquals( f1.getVersions( "1.2,1.3" ),
- asSet( f1v12, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.0,1.2,1.2.1,1.3,2.0" ),
- asSet( f1v10, f1v12, f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "[1.2" ),
- asSet( f1v12, f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "(1.2" ),
- asSet( f1v121, f1v13, f1v20 ) );
-
- assertEquals( f1.getVersions( "1.3]" ),
- asSet( f1v10, f1v12, f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.3)" ),
- asSet( f1v10, f1v12, f1v121 ) );
-
- assertEquals( f1.getVersions( "[1.2-1.3]" ),
- asSet( f1v12, f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "[1.2-1.3)" ),
- asSet( f1v12, f1v121 ) );
-
- assertEquals( f1.getVersions( "(1.2-1.3]" ),
- asSet( f1v121, f1v13 ) );
-
- assertEquals( f1.getVersions( "1.0,(1.2-1.3],2.0" ),
- asSet( f1v10, f1v121, f1v13, f1v20 ) );
- }
-
- public void testConstraints()
- {
- /*
- * Version: 3.5
- *
- * <requires facet="facet1" version="1.0"/>
- */
-
- assertFalse( f2v35.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertTrue( f2v35.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertFalse( f2v35.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 3.5#a
- *
- * <and>
- * <requires facet="facet1" version="[1.2-1.3)"/>
- * </and>
- */
-
- assertFalse( f2v35a.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertTrue( f2v35a.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertTrue( f2v35a.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertFalse( f2v35a.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7
- *
- * <or>
- * <requires facet="facet1" version="[1.3"/>
- * </or>
- */
-
- assertFalse( f2v47.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v47.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7#b
- *
- * <or>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- */
-
- assertFalse( f2v47b.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertFalse( f2v47b.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47b.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47b.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- /*
- * Version: 4.7#c
- *
- * <and>
- * <or>
- * <requires facet="facet1" version="1.2.1"/>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- * <conflicts facet="facet3a"/>
- * <conflicts facet="facet3b" version="1.0"/>
- * <conflicts group="group1"/>
- * </and>
- */
-
- assertFalse( f2v47c.getConstraint().check( Collections.EMPTY_SET ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v12 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v121 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v13 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v20 ) ).isOK() );
-
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3av10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3av20 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3bv10 ) ).isOK() );
- assertTrue( f2v47c.getConstraint().check( asSet( f1v20, f3bv20 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3cv10 ) ).isOK() );
- assertFalse( f2v47c.getConstraint().check( asSet( f1v20, f3cv20 ) ).isOK() );
- }
-
- public void testConstraintApi()
- {
- assertEquals( IConstraint.Type.AND.name(), "and" );
- assertTrue( IConstraint.Type.valueOf( "and" ) == IConstraint.Type.AND );
- assertTrue( IConstraint.Type.valueOf( "aNd" ) == IConstraint.Type.AND );
-
- assertEquals( IConstraint.Type.OR.name(), "or" );
- assertTrue( IConstraint.Type.valueOf( "or" ) == IConstraint.Type.OR );
- assertTrue( IConstraint.Type.valueOf( "oR" ) == IConstraint.Type.OR );
-
- assertEquals( IConstraint.Type.REQUIRES.name(), "requires" );
- assertTrue( IConstraint.Type.valueOf( "requires" ) == IConstraint.Type.REQUIRES );
- assertTrue( IConstraint.Type.valueOf( "rEqUiRes" ) == IConstraint.Type.REQUIRES );
-
- assertEquals( IConstraint.Type.CONFLICTS.name(), "conflicts" );
- assertTrue( IConstraint.Type.valueOf( "conflicts" ) == IConstraint.Type.CONFLICTS );
- assertTrue( IConstraint.Type.valueOf( "cOnFlIcTs" ) == IConstraint.Type.CONFLICTS );
-
- /*
- * <and>
- * <or>
- * <requires facet="facet1" version="1.2.1"/>
- * <requires facet="facet1" version="1.3"/>
- * <requires facet="facet1" version="2.0"/>
- * </or>
- * <conflicts facet="facet3a"/>
- * <conflicts facet="facet3b" version="1.0"/>
- * <conflicts group="group1"/>
- * </and>
- */
-
- assertTrue( ProjectFacetsManager.isGroupDefined( "group1" ) );
- final IGroup g = ProjectFacetsManager.getGroup( "group1" );
- assertEquals( g.getId(), "group1" );
- assertEquals( g.getMembers(), asSet( f2v47c, f3cv10, f3cv20 ) );
-
- final IConstraint root = f2v47c.getConstraint();
- checkConstraint( root, IConstraint.Type.AND, null, null, null, null );
-
- IConstraint c1, c2;
-
- c1 = (IConstraint) root.getOperand( 0 );
- checkConstraint( c1, IConstraint.Type.OR, null, null, null );
-
- c2 = (IConstraint) c1.getOperand( 0 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "1.2.1", Boolean.FALSE );
-
- c2 = (IConstraint) c1.getOperand( 1 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "1.3", Boolean.FALSE );
-
- c2 = (IConstraint) c1.getOperand( 2 );
- checkConstraint( c2, IConstraint.Type.REQUIRES, f1, "2.0", Boolean.FALSE );
-
- c1 = (IConstraint) root.getOperand( 1 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, f3a );
-
- c1 = (IConstraint) root.getOperand( 2 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, f3b, "1.0" );
-
- c1 = (IConstraint) root.getOperand( 3 );
- checkConstraint( c1, IConstraint.Type.CONFLICTS, g );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand )
- {
- checkConstraint( c, expectedType, new Object[] { expectedOperand } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2,
- final Object expectedOperand3 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2,
- expectedOperand3 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object expectedOperand1,
- final Object expectedOperand2,
- final Object expectedOperand3,
- final Object expectedOperand4 )
- {
- checkConstraint( c, expectedType,
- new Object[] { expectedOperand1, expectedOperand2,
- expectedOperand3, expectedOperand4 } );
- }
-
- private static void checkConstraint( final IConstraint c,
- final IConstraint.Type expectedType,
- final Object[] expectedOperands )
- {
- assertEquals( c.getType(), expectedType );
-
- final int count = c.getOperands().size();
- assertEquals( count, expectedOperands.length );
-
- final List list = new ArrayList();
-
- for( int i = 0; i < count; i++ )
- {
- final Object operand = c.getOperand( i );
- final Object expected = expectedOperands[ i ];
-
- if( expected != null )
- {
- if( ( expected instanceof String ) &&
- ! ( operand instanceof String ) )
- {
- assertEquals( operand.toString(), expected );
- }
- else
- {
- assertEquals( operand, expected );
- }
- }
-
- list.add( c.getOperand( i ) );
- }
-
- assertEquals( c.getOperands(), list );
- }
-
- private static Set asSet( final Object obj )
- {
- return asSet( new Object[] { obj } );
- }
-
- private static Set asSet( final Object obj1,
- final Object obj2 )
- {
- return asSet( new Object[] { obj1, obj2 } );
- }
-
- private static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3 )
- {
- return asSet( new Object[] { obj1, obj2, obj3 } );
- }
-
- private static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4 )
- {
- return asSet( new Object[] { obj1, obj2, obj3, obj4 } );
- }
-
- private static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4,
- final Object obj5 )
- {
- return asSet( new Object[] { obj1, obj2, obj3, obj4, obj5 } );
- }
-
- private static Set asSet( final Object[] array )
- {
- final HashSet set = new HashSet();
- set.addAll( Arrays.asList( array ) );
- return set;
- }
-
- private static List asList( final Object obj )
- {
- return asList( new Object[] { obj } );
- }
-
- private static List asList( final Object obj1,
- final Object obj2 )
- {
- return asList( new Object[] { obj1, obj2 } );
- }
-
- private static List asList( final Object obj1,
- final Object obj2,
- final Object obj3 )
- {
- return asList( new Object[] { obj1, obj2, obj3 } );
- }
-
- private static List asList( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4 )
- {
- return asList( new Object[] { obj1, obj2, obj3, obj4 } );
- }
-
- private static List asList( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4,
- final Object obj5 )
- {
- return asList( new Object[] { obj1, obj2, obj3, obj4, obj5 } );
- }
-
- private static List asList( final Object[] array )
- {
- return Arrays.asList( array );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java
deleted file mode 100644
index 9007273..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/FacetActionSortTests.java
+++ /dev/null
@@ -1,187 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-
-public class FacetActionSortTests
-
- extends TestCase
-
-{
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- private static IProjectFacet f2;
- private static IProjectFacetVersion f2v35;
- private static IProjectFacetVersion f2v35a;
- private static IProjectFacetVersion f2v47;
- private static IProjectFacetVersion f2v47b;
- private static IProjectFacetVersion f2v47c;
-
- private static IProjectFacet f2ext;
- private static IProjectFacetVersion f2extv10;
-
- private static IProjectFacet f3a;
- private static IProjectFacetVersion f3av10;
- private static IProjectFacetVersion f3av20;
-
- private static IProjectFacet f3b;
- private static IProjectFacetVersion f3bv10;
- private static IProjectFacetVersion f3bv20;
-
- private static IProjectFacet f3c;
- private static IProjectFacetVersion f3cv10;
- private static IProjectFacetVersion f3cv20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
-
- f2 = ProjectFacetsManager.getProjectFacet( "facet2" );
- f2v35 = f2.getVersion( "3.5" );
- f2v35a = f2.getVersion( "3.5#a" );
- f2v47 = f2.getVersion( "4.7" );
- f2v47b = f2.getVersion( "4.7#b" );
- f2v47c = f2.getVersion( "4.7#c" );
-
- f2ext = ProjectFacetsManager.getProjectFacet( "facet2ext" );
- f2extv10 = f2ext.getVersion( "1.0" );
-
- f3a = ProjectFacetsManager.getProjectFacet( "facet3a" );
- f3av10 = f3a.getVersion( "1.0" );
- f3av20 = f3a.getVersion( "2.0" );
-
- f3b = ProjectFacetsManager.getProjectFacet( "facet3b" );
- f3bv10 = f3b.getVersion( "1.0" );
- f3bv20 = f3b.getVersion( "2.0" );
-
- f3c = ProjectFacetsManager.getProjectFacet( "facet3c" );
- f3cv10 = f3c.getVersion( "1.0" );
- f3cv20 = f3c.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private FacetActionSortTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Facet Action Sort Tests" );
-
- suite.addTest( new FacetActionSortTests( "testUninstallComesFirst1" ) );
- suite.addTest( new FacetActionSortTests( "testUninstallComesFirst2" ) );
- suite.addTest( new FacetActionSortTests( "testSortStability1" ) );
- suite.addTest( new FacetActionSortTests( "testSortStability2" ) );
-
- return suite;
- }
-
- /**
- * Tests whether the sort places uninstall actions first. This is the
- * control test case. The input already places uninstall first.
- */
-
- public void testUninstallComesFirst1()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.UNINSTALL, f3av10, null );
-
- final ArrayList actions = new ArrayList();
-
- actions.add( a2 );
- actions.add( a1 );
-
- ProjectFacetsManager.sort( TestUtils.asSet( f3av10 ), actions );
- assertEquals( actions, TestUtils.asList( a2, a1 ) );
- }
-
- /**
- * Tests whether the sort places uninstall actions first. The test case
- * places an install action in front of the uninstall action and checks
- * whether the sort algorithm reverses the order.
- */
-
- public void testUninstallComesFirst2()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.UNINSTALL, f3av10, null );
-
- final ArrayList actions = new ArrayList();
-
- actions.add( a1 );
- actions.add( a2 );
-
- ProjectFacetsManager.sort( TestUtils.asSet( f3av10 ), actions );
- assertEquals( actions, TestUtils.asList( a2, a1 ) );
- }
-
- /**
- * Tests whether the sort produces "stable" results given unrelated facets.
- * This is the control test case. The input is already in the correct order.
- */
-
- public void testSortStability1()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.INSTALL, f3av10, null );
-
- final ArrayList actions = new ArrayList();
-
- actions.add( a1 );
- actions.add( a2 );
-
- ProjectFacetsManager.sort( Collections.EMPTY_SET, actions );
- assertEquals( actions, TestUtils.asList( a1, a2 ) );
- }
-
- /**
- * Tests whether the sort produces "stable" results given unrelated facets.
- * The input facets are in the reverse order.
- */
-
- public void testSortStability2()
- {
- final Action a1 = new Action( Action.Type.INSTALL, f1v12, null );
- final Action a2 = new Action( Action.Type.INSTALL, f3av10, null );
-
- final ArrayList actions = new ArrayList();
-
- actions.add( a2 );
- actions.add( a1 );
-
- ProjectFacetsManager.sort( Collections.EMPTY_SET, actions );
- assertEquals( actions, TestUtils.asList( a1, a2 ) );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java
deleted file mode 100644
index cc9606f..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectChangeReactionTests.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils.ICondition;
-
-public final class ProjectChangeReactionTests
-
- extends AbstractTests
-
-{
- private static final String METADATA_FILE
- = ".settings/org.eclipse.wst.common.project.facet.core.xml";
-
- private static final String TEST_PROJECT_NAME = "testProject";
-
- private static IProjectFacet f1;
- private static IProjectFacetVersion f1v10;
- private static IProjectFacetVersion f1v12;
- private static IProjectFacetVersion f1v121;
- private static IProjectFacetVersion f1v13;
- private static IProjectFacetVersion f1v20;
-
- static
- {
- try
- {
- f1 = ProjectFacetsManager.getProjectFacet( "facet1" );
- f1v10 = f1.getVersion( "1.0" );
- f1v12 = f1.getVersion( "1.2" );
- f1v121 = f1.getVersion( "1.2.1" );
- f1v13 = f1.getVersion( "1.3" );
- f1v20 = f1.getVersion( "2.0" );
- }
- catch( Exception e )
- {
- // Ignore failures. This api is tested explicitly.
- }
- }
-
- private IProject pj;
- private IFacetedProject fpj;
- private IFile mdfile;
-
- private ProjectChangeReactionTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Project Change Reaction Tests" );
-
- suite.addTest( new ProjectChangeReactionTests( "testReactionToProjectDelete" ) );
- suite.addTest( new ProjectChangeReactionTests( "testReactionToMetadataFileDelete" ) );
- suite.addTest( new ProjectChangeReactionTests( "testReactionToMetadataFileChange" ) );
-
- return suite;
- }
-
- protected void setUp()
-
- throws CoreException
-
- {
- assertFalse( ws.getRoot().getProject( TEST_PROJECT_NAME ).exists() );
-
- this.fpj = ProjectFacetsManager.create( TEST_PROJECT_NAME, null, null );
-
- this.pj = this.fpj.getProject();
- addResourceToCleanup( this.pj );
- assertTrue( this.fpj.getProject().exists() );
-
- this.fpj.installProjectFacet( f1v12, null, null );
- assertEquals( this.fpj.getProjectFacets(), TestUtils.asSet( f1v12 ) );
-
- this.mdfile = this.pj.getFile( METADATA_FILE );
- }
-
- public void testReactionToProjectDelete()
-
- throws CoreException
-
- {
- this.pj.delete( true, null );
-
- TestUtils.waitForCondition( createNoFacetsCondition( this.fpj ) );
- assertNull( ProjectFacetsManager.create( this.pj ) );
- }
-
- public void testReactionToMetadataFileDelete()
-
- throws CoreException
-
- {
- this.mdfile.delete( true, null );
-
- TestUtils.waitForCondition( createNoFacetsCondition( this.fpj ) );
- }
-
- public void testReactionToMetadataFileChange()
-
- throws CoreException, IOException
-
- {
- String contents;
-
- contents = TestUtils.readFromFile( this.mdfile );
- contents = contents.replaceFirst( "1.2", "2.0" );
- TestUtils.writeToFile( this.mdfile, contents );
-
- TestUtils.waitForCondition( createFacetCondition( this.fpj, f1v20 ) );
-
- contents = contents.replaceFirst( "2.0", "1.2.1" );
- TestUtils.writeToFile( this.mdfile, contents );
-
- TestUtils.waitForCondition( createFacetCondition( this.fpj, f1v121 ) );
-
- contents = contents.replaceFirst( "<installed facet=\"facet1\" version=\"1.2.1\"/>", "" );
- TestUtils.writeToFile( this.mdfile, contents );
-
- TestUtils.waitForCondition( createNoFacetsCondition( this.fpj ) );
- }
-
- private static ICondition createNoFacetsCondition( final IFacetedProject fpj )
- {
- return new ICondition()
- {
- public boolean check()
- {
- return fpj.getProjectFacets().size() == 0;
- }
- };
- }
-
- private static ICondition createFacetCondition( final IFacetedProject fpj,
- final IProjectFacetVersion fv )
- {
- return new ICondition()
- {
- public boolean check()
- {
- return fpj.hasProjectFacet( fv );
- }
- };
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java
deleted file mode 100644
index 94e4788..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/ProjectCreationTests.java
+++ /dev/null
@@ -1,329 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.tests.support.TestUtils;
-
-public final class ProjectCreationTests
-
- extends AbstractTests
-
-{
- private static final String FACETED_PROJECT_NATURE
- = "org.eclipse.wst.common.project.facet.core.nature";
-
- private ProjectCreationTests( final String name )
- {
- super( name );
- }
-
- public static Test suite()
- {
- final TestSuite suite = new TestSuite();
-
- suite.setName( "Project Creation Tests" );
-
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch1" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch2" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromScratch3" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject1" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject2" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject3" ) );
- suite.addTest( new ProjectCreationTests( "testCreationFromNonFacetedProject4" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation1" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation2" ) );
- suite.addTest( new ProjectCreationTests( "testWrapperCreation3" ) );
-
- return suite;
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is no project with the same name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch1()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
-
- assertNotNull( proj );
- assertTrue( proj.exists() );
-
- this.resourcesToCleanup.add( proj );
-
- TestUtils.assertFileContains( proj.getFile( ".project" ), FACETED_PROJECT_NATURE );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is a faceted project with the same name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch2()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- this.resourcesToCleanup.add( fproj.getProject() );
-
- try
- {
- ProjectFacetsManager.create( "abc", null, null );
- fail();
- }
- catch( CoreException e )
- {
- // expected
- }
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(String,IPath,IProgressMonitor)}
- * method. In this scenario, there is a non-faceted project with the same
- * name.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromScratch3()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- try
- {
- ProjectFacetsManager.create( "abc", null, null );
- fail();
- }
- catch( CoreException e )
- {
- // expected
- }
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is not faceted and convertIfNecessary
- * is set to true.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject1()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, true, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is faceted and convertIfNecessary
- * is set to true.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject2()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject prior
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject project = prior.getProject();
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, true, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is faceted and convertIfNecessary
- * is set to false.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject3()
-
- throws CoreException, IOException
-
- {
- final IFacetedProject prior
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject project = prior.getProject();
-
- this.resourcesToCleanup.add( project );
-
- final IFacetedProject fproj
- = ProjectFacetsManager.create( project, false, null );
-
- assertEquals( fproj.getFixedProjectFacets().size(), 0 );
- assertEquals( fproj.getProjectFacets().size(), 0 );
- assertEquals( fproj.getTargetedRuntimes().size(), 0 );
- assertNull( fproj.getPrimaryRuntime() );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject,boolean,IProgressMonitor)}
- * method. In this scenario project is not faceted and convertIfNecessary
- * is set to false.
- *
- * @throws CoreException
- * @throws IOException
- */
-
- public void testCreationFromNonFacetedProject4()
-
- throws CoreException, IOException
-
- {
- final IProject project = ws.getRoot().getProject( "abc" );
- final IProjectDescription desc = ws.newProjectDescription( "abc" );
-
- desc.setLocation( null );
-
- project.create( desc, null );
- project.open( IResource.BACKGROUND_REFRESH, null );
-
- this.resourcesToCleanup.add( project );
-
- assertNull( ProjectFacetsManager.create( project, false, null ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. This scenario
- * validates that the wrapper cache is working and the same instance is
- * returned when the create method is called multiple times.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation1()
-
- throws CoreException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
- this.resourcesToCleanup.add( proj );
-
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- assertTrue( fproj == ProjectFacetsManager.create( proj ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. In this
- * scenario, the input project does not exist.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation2()
-
- throws CoreException
-
- {
- final IProject proj = ws.getRoot().getProject( "abc" );
- assertNull( ProjectFacetsManager.create( proj ) );
- }
-
- /**
- * Tests {@see ProjectFacetsManager.create(IProject)} method. In this
- * scenario, the input project is closed.
- *
- * @throws CoreException
- */
-
- public void testWrapperCreation3()
-
- throws CoreException
-
- {
- final IFacetedProject fproj
- = ProjectFacetsManager.create( "abc", null, null );
-
- final IProject proj = fproj.getProject();
- this.resourcesToCleanup.add( proj );
-
- proj.close( null );
-
- assertNull( ProjectFacetsManager.create( proj ) );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java
deleted file mode 100644
index 470ce14..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/CustomVersionComparator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
-import org.eclipse.wst.common.project.facet.core.VersionFormatException;
-
-public final class CustomVersionComparator
-
- extends DefaultVersionComparator
-
-{
- protected String getSeparators()
- {
- return ".#";
- }
-
- protected Comparable parse( final String version,
- final String segment,
- final int position )
-
- throws VersionFormatException
-
- {
- if( position == 2 )
- {
- return new Inverter( segment );
- }
- else
- {
- return super.parse( version, segment, position );
- }
- }
-
- public static class Inverter
-
- implements Comparable
-
- {
- private final Comparable base;
-
- public Inverter( final Comparable base )
- {
- this.base = base;
- }
-
- public boolean equals( final Object obj )
- {
- if( ! ( obj instanceof Inverter ) )
- {
- return false;
- }
- else
- {
- return this.base.equals( ( (Inverter) obj ).base );
- }
- }
-
- public int compareTo( final Object obj )
- {
- return -1 * this.base.compareTo( ( (Inverter) obj ).base );
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java
deleted file mode 100644
index 4590e3e..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1InstallDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet1InstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java
deleted file mode 100644
index baaafec..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1UninstallDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet1UninstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- file.delete( true, null );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java
deleted file mode 100644
index 48650c5..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet1VersionChangeDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet1VersionChangeDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet1.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java
deleted file mode 100644
index ece8270..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aInstallDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet3aInstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java
deleted file mode 100644
index eca1812..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aUninstallDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet3aUninstallDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- file.delete( true, null );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java
deleted file mode 100644
index 060a839..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/Facet3aVersionChangeDelegate.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public final class Facet3aVersionChangeDelegate
-
- implements IDelegate
-
-{
- public void execute( final IProject project,
- final IProjectFacetVersion fv,
- final Object config,
- final IProgressMonitor monitor )
-
- throws CoreException
-
- {
- final IFile file = project.getFile( "facet3a.txt" );
- TestUtils.writeToFile( file, fv.getVersionString() );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java b/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java
deleted file mode 100644
index ae35782..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/src/org/eclipse/wst/common/project/facet/core/tests/support/TestUtils.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package org.eclipse.wst.common.project.facet.core.tests.support;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-
-public class TestUtils
-{
- public static void writeToFile( final IFile file,
- final String contents )
-
- throws CoreException
-
- {
- try
- {
- final byte[] bytes = contents.getBytes( "UTF-8" );
-
- if( file.exists() )
- {
- file.setContents( new ByteArrayInputStream( bytes ),
- false, false, null );
- }
- else
- {
- file.create( new ByteArrayInputStream( bytes ), false, null );
- }
- }
- catch( UnsupportedEncodingException e )
- {
- throw new RuntimeException( e );
- }
- }
-
- public static String readFromFile( final IFile file )
-
- throws CoreException, IOException
-
- {
- TestCase.assertTrue( file.exists() );
-
- final StringBuffer buf = new StringBuffer();
- final Reader r = new InputStreamReader( file.getContents() );
-
- try
- {
- char[] chars = new char[ 1024 ];
-
- for( int count; ( count = r.read( chars ) ) != -1; )
- {
- buf.append( chars, 0, count );
- }
- }
- finally
- {
- try
- {
- r.close();
- }
- catch( IOException e ) {}
- }
-
- return buf.toString();
- }
-
-
- public static void assertEquals( final IFile file,
- final String expectedContents )
-
- throws CoreException, IOException
-
- {
- TestCase.assertEquals( readFromFile( file ), expectedContents );
- }
-
- public static void assertFileContains( final IFile file,
- final String str )
-
- throws CoreException, IOException
-
- {
- TestCase.assertTrue( readFromFile( file ).indexOf( str ) != -1 );
- }
-
- public static void waitForCondition( final ICondition condition )
- {
- waitForCondition( condition, 10 );
- }
-
- public static void waitForCondition( final ICondition condition,
- final int seconds )
- {
- for( int i = 0; i < seconds && ! condition.check(); i++ )
- {
- try
- {
- Thread.sleep( 1000 );
- }
- catch( InterruptedException e ) {}
- }
-
- TestCase.assertTrue( condition.check() );
- }
-
- public static interface ICondition
- {
- boolean check();
- }
-
- public static Set asSet( final Object obj )
- {
- return asSet( new Object[] { obj } );
- }
-
- public static Set asSet( final Object obj1,
- final Object obj2 )
- {
- return asSet( new Object[] { obj1, obj2 } );
- }
-
- public static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3 )
- {
- return asSet( new Object[] { obj1, obj2, obj3 } );
- }
-
- public static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4 )
- {
- return asSet( new Object[] { obj1, obj2, obj3, obj4 } );
- }
-
- public static Set asSet( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4,
- final Object obj5 )
- {
- return asSet( new Object[] { obj1, obj2, obj3, obj4, obj5 } );
- }
-
- public static Set asSet( final Object[] array )
- {
- final HashSet set = new HashSet();
- set.addAll( Arrays.asList( array ) );
- return set;
- }
-
- public static List asList( final Object obj )
- {
- return asList( new Object[] { obj } );
- }
-
- public static List asList( final Object obj1,
- final Object obj2 )
- {
- return asList( new Object[] { obj1, obj2 } );
- }
-
- public static List asList( final Object obj1,
- final Object obj2,
- final Object obj3 )
- {
- return asList( new Object[] { obj1, obj2, obj3 } );
- }
-
- public static List asList( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4 )
- {
- return asList( new Object[] { obj1, obj2, obj3, obj4 } );
- }
-
- public static List asList( final Object obj1,
- final Object obj2,
- final Object obj3,
- final Object obj4,
- final Object obj5 )
- {
- return asList( new Object[] { obj1, obj2, obj3, obj4, obj5 } );
- }
-
- public static List asList( final Object[] array )
- {
- return Arrays.asList( array );
- }
-
-}
diff --git a/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml b/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml
deleted file mode 100644
index f1b343d..0000000
--- a/tests/org.eclipse.wst.common.project.facet.core.tests/test.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
-
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
-
- <property name="plugin-name" value="org.eclipse.wst.common.project.facet.core.tests"/>
- <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
-
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="${plugin-name}*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
-
- <target name="suite">
- <property name="wst-folder" value="${eclipse-home}/wst_folder"/>
- <delete dir="${wst-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${wst-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.wst.common.project.facet.core.tests.AllTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
-
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
-
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="${plugin-name}*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
\ No newline at end of file