/**
  * Test isa function on an implied type.
  *
  * @exception Exception if a test error occurs
  */
 public void testIsa() throws Exception {
   String path = "dpml/tools/dpml-tools-ant";
   Resource resource = getLibrary().getResource(path);
   assertTrue("isa-jar", resource.isa("jar"));
   assertTrue("isa-plugin", resource.isa("part"));
   assertFalse("isa-rabbit", resource.isa("rabbit"));
 }
 /**
  * Testing aggregated providers.
  *
  * @exception Exception if a test error occurs
  */
 public void testAggregatedExpandedProvidersCase3() throws Exception {
   Resource resource = getLibrary().getResource("dpml/metro/dpml-component-model");
   Resource[] build = resource.getAggregatedProviders(Scope.BUILD, true, false);
   Resource[] runtime = resource.getAggregatedProviders(Scope.RUNTIME, true, false);
   Resource[] test = resource.getAggregatedProviders(Scope.TEST, true, false);
   assertEquals("build", 0, build.length);
   assertEquals("runtime", 5, runtime.length);
   assertEquals("test", 12, test.length);
 }
 /**
  * Testing aggregated providers.
  *
  * @exception Exception if a test error occurs
  */
 public void testAggregatedExpandedProvidersCase2() throws Exception {
   Resource resource = getLibrary().getResource("dpml/transit/dpml-transit-tools");
   Resource[] build = resource.getAggregatedProviders(Scope.BUILD, true, false);
   Resource[] runtime = resource.getAggregatedProviders(Scope.RUNTIME, true, false);
   Resource[] test = resource.getAggregatedProviders(Scope.TEST, true, false);
   assertEquals("build", 0, build.length);
   assertEquals("runtime", 3, runtime.length);
   assertEquals("test", 5, test.length);
 }
 /**
  * Testing aggregated providers.
  *
  * @exception Exception if a test error occurs
  */
 public void testAggregatedProvidersCase1() throws Exception {
   Resource resource = getLibrary().getResource("dpml/metro/dpml-composition-runtime");
   Resource[] build = resource.getAggregatedProviders(Scope.BUILD, false, false);
   Resource[] runtime = resource.getAggregatedProviders(Scope.RUNTIME, false, false);
   Resource[] test = resource.getAggregatedProviders(Scope.TEST, false, false);
   assertEquals("build", 0, build.length);
   assertEquals("runtime", 6, runtime.length);
   assertEquals("test", 6, test.length);
 }
 /**
  * Test resource types.
  *
  * @exception Exception if a test error occurs
  */
 public void testTypeNames() throws Exception {
   String path = "dpml/metro/dpml-composition-runtime";
   Resource resource = getLibrary().getResource(path);
   Type[] types = resource.getTypes();
   Type jar = types[0];
   Type part = types[1];
   assertEquals("types-length", 2, types.length);
   assertEquals("jar-type", "jar", jar.getID());
   assertEquals("part-type", "part", part.getID());
 }
 /**
  * Test basedir feature.
  *
  * @exception Exception if a test error occurs
  */
 public void testBaseDir() throws Exception {
   String path = "dpml";
   Resource resource = getLibrary().getResource(path);
   File basedir = resource.getBaseDir();
   assertNotNull("basedir", basedir);
   String testPath = System.getProperty("project.test.dir");
   File test = new File(testPath);
   File dpml = new File(test, "dpml");
   File base = new File(dpml, "..").getCanonicalFile();
   assertEquals("basedir", base, basedir);
 }
 private int doCategoryTest(String path, Category category, int n) throws Exception {
   Resource resource = getLibrary().getResource(path);
   Resource[] chain = resource.getClasspathProviders(category);
   int j = chain.length;
   if (n > -1) {
     assertEquals("chain-length in " + path, n, j);
   } else {
     System.out.println("# " + path + ", " + category.getName().toUpperCase());
     for (int i = 0; i < chain.length; i++) {
       System.out.println("# (" + (i + 1) + ") " + chain[i]);
     }
   }
   return chain.length;
 }
 /**
  * Test artifact uri function.
  *
  * @exception Exception if a test error occurs
  */
 public void testArtifact() throws Exception {
   String path = "dpml/tools/dpml-tools-ant";
   Resource resource = getLibrary().getResource(path);
   Type[] types = resource.getTypes();
   for (int i = 0; i < types.length; i++) {
     Type type = types[i];
     Artifact artifact = resource.getArtifact(type.getID());
     String urn =
         "artifact:"
             + type.getID()
             + ":"
             + resource.getResourcePath()
             + "#"
             + resource.getVersion();
     assertEquals("uri", urn, artifact.toURI().toString());
   }
 }
 /**
  * Test enclosing parent module.
  *
  * @exception Exception if a test error occurs
  */
 public void testGetParent() throws Exception {
   String path = "dpml/tools/dpml-tools-ant";
   Resource dpml = getLibrary().getResource("dpml");
   Resource tools = getLibrary().getResource("dpml/tools");
   Resource ant = getLibrary().getResource("dpml/tools/dpml-tools-ant");
   assertEquals("parent", null, dpml.getParent());
   assertEquals("parent", dpml, tools.getParent());
   assertEquals("parent", tools, ant.getParent());
 }
 /**
  * Test resource path.
  *
  * @exception Exception if a test error occurs
  */
 public void testResourcePath() throws Exception {
   String path = "dpml/metro/dpml-composition-runtime";
   Resource resource = getLibrary().getResource(path);
   assertEquals("resource-path", path, resource.getResourcePath());
 }
 /**
  * Test resource version.
  *
  * @exception Exception if a test error occurs
  */
 public void testSnapshotVersion() throws Exception {
   System.getProperties().remove("build.signature");
   Resource resource = getLibrary().getResource("dpml/metro/dpml-composition-runtime");
   String version = resource.getVersion();
   assertEquals("version", "SNAPSHOT", version);
 }
 /**
  * Test assigned build signature version.
  *
  * @exception Exception if a test error occurs
  */
 public void testExplicitVersion() throws Exception {
   Resource resource = getLibrary().getResource("junit/junit");
   String version = resource.getVersion();
   assertEquals("version", "@JUNIT_VERSION@", version);
 }
 /**
  * Test resource name.
  *
  * @exception Exception if a test error occurs
  */
 public void testName() throws Exception {
   Resource resource = getLibrary().getResource("dpml/metro/dpml-composition-runtime");
   String name = resource.getName();
   assertEquals("name", "dpml-composition-runtime", name);
 }
 /**
  * Testing transitive consumers.
  *
  * @exception Exception if a test error occurs
  */
 public void testTransitiveConsumers() throws Exception {
   String path = "dpml/transit/dpml-transit-main";
   Resource resource = getLibrary().getResource(path);
   Resource[] consumers = resource.getConsumers(true, true);
   assertEquals("consumer-count", 18, consumers.length);
 }
 /**
  * Testing test classpath providers.
  *
  * @exception Exception if a test error occurs
  */
 public void testTestClasspathProviders() throws Exception {
   String path = "dpml/transit/dpml-transit-tools";
   Resource resource = getLibrary().getResource(path);
   Resource[] chain = resource.getClasspathProviders(Scope.TEST);
   assertEquals("chain-length", 5, chain.length);
 }
 /**
  * Test basedir feature.
  *
  * @exception Exception if a test error occurs
  */
 public void testNullBaseDir() throws Exception {
   String path = "ant/ant";
   Resource resource = getLibrary().getResource(path);
   File basedir = resource.getBaseDir();
   assertNull("basedir", basedir);
 }