/** * 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 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()); } }