Index: src/org/netbeans/api/project/ant/AntArtifact.java =================================================================== RCS file: /cvs/ant/project/src/org/netbeans/api/project/ant/AntArtifact.java,v retrieving revision 1.7 diff -u -r1.7 AntArtifact.java --- src/org/netbeans/api/project/ant/AntArtifact.java 1 May 2004 15:13:14 -0000 1.7 +++ src/org/netbeans/api/project/ant/AntArtifact.java 12 May 2004 16:06:48 -0000 @@ -91,7 +91,17 @@ * may be either relative, or an absolute file-protocol URI */ public abstract URI getArtifactLocation(); - + + /** + * Returns identifier of the AntArtifact which must be unique within + * one project. By default it is target name which produces the + * artifact, but if your target produces more that one artifact then + * you must override this method and uniquely identify each artifact. + */ + public String getID() { + return getTargetName(); + } + /** * Convenience method to find the actual artifact, if it currently exists. * Uses {@link #getScriptFile} or {@link #getScriptLocation} and resolves {@link #getArtifactLocation} from it. Index: src/org/netbeans/api/project/ant/AntArtifactQuery.java =================================================================== RCS file: /cvs/ant/project/src/org/netbeans/api/project/ant/AntArtifactQuery.java,v retrieving revision 1.3 diff -u -r1.3 AntArtifactQuery.java --- src/org/netbeans/api/project/ant/AntArtifactQuery.java 2 Apr 2004 10:45:17 -0000 1.3 +++ src/org/netbeans/api/project/ant/AntArtifactQuery.java 12 May 2004 16:06:48 -0000 @@ -60,18 +60,18 @@ * Try to find a particular build artifact according to the Ant target producing it. * @param p a project (should have {@link AntArtifactProvider} in lookup * in order for this query to work) - * @param targetName a desired {@link AntArtifact#getTargetName target name} + * @param id a desired {@link AntArtifact#getID ID} * @return an artifact produced by that project with the specified target, * or null if none such can be found */ - public static AntArtifact findArtifactByTarget(Project p, String targetName) { + public static AntArtifact findArtifactByID(Project p, String id) { AntArtifactProvider prov = (AntArtifactProvider)p.getLookup().lookup(AntArtifactProvider.class); if (prov == null) { return null; } AntArtifact[] artifacts = prov.getBuildArtifacts(); for (int i = 0; i < artifacts.length; i++) { - if (artifacts[i].getTargetName().equals(targetName)) { + if (artifacts[i].getID().equals(id)) { return artifacts[i]; } } Index: src/org/netbeans/spi/project/ant/AntArtifactProvider.java =================================================================== RCS file: /cvs/ant/project/src/org/netbeans/spi/project/ant/AntArtifactProvider.java,v retrieving revision 1.3 diff -u -r1.3 AntArtifactProvider.java --- src/org/netbeans/spi/project/ant/AntArtifactProvider.java 3 Apr 2004 03:17:00 -0000 1.3 +++ src/org/netbeans/spi/project/ant/AntArtifactProvider.java 12 May 2004 16:06:48 -0000 @@ -30,7 +30,8 @@ * @return a list of build artifacts produced by this project; * the target names must be distinct, and if this provider is in a * project's lookup, {@link AntArtifact#getProject} must return the - * same project + * same project; list of artifacts for one project cannot contain + * two artifacts with the same {@link AntArtifact#getID ID} */ AntArtifact[] getBuildArtifacts(); Index: src/org/netbeans/spi/project/support/ant/ReferenceHelper.java =================================================================== RCS file: /cvs/ant/project/src/org/netbeans/spi/project/support/ant/ReferenceHelper.java,v retrieving revision 1.7 diff -u -r1.7 ReferenceHelper.java --- src/org/netbeans/spi/project/support/ant/ReferenceHelper.java 22 Apr 2004 15:59:31 -0000 1.7 +++ src/org/netbeans/spi/project/support/ant/ReferenceHelper.java 12 May 2004 16:06:48 -0000 @@ -193,7 +193,7 @@ } File scriptFile = artifact.getScriptLocation(); URI scriptLocation = forProjDir.toURI().relativize(scriptFile.toURI()); - RawReference ref = new RawReference(forProjName, artifact.getType(), scriptLocation, artifact.getTargetName(), artifact.getCleanTargetName()); + RawReference ref = new RawReference(forProjName, artifact.getType(), scriptLocation, artifact.getTargetName(), artifact.getCleanTargetName(), artifact.getID()); Element references = loadReferences(true); boolean success; try { @@ -237,7 +237,7 @@ propertiesFile = AntProjectHelper.PROJECT_PROPERTIES_PATH; } props = h.getProperties(propertiesFile); - String refPathProp = "reference." + forProjName + '.' + artifact.getTargetName(); // NOI18N + String refPathProp = "reference." + forProjName + '.' + artifact.getID(); // NOI18N if (!refPath.equals(props.getProperty(refPathProp))) { props.setProperty(refPathProp, refPath); h.putProperties(propertiesFile, props); @@ -303,15 +303,16 @@ break; } if (testRef.getForeignProjectName().equals(ref.getForeignProjectName())) { - if (testRef.getTargetName().compareTo(ref.getTargetName()) > 0) { + if (testRef.getID().compareTo(ref.getID()) > 0) { // again, gone too far, go back nextRefEl = testRefEl; break; } - if (testRef.getTargetName().equals(ref.getTargetName())) { + if (testRef.getID().equals(ref.getID())) { // Key match, check if it needs to be updated. if (testRef.getArtifactType().equals(ref.getArtifactType()) && testRef.getScriptLocation().equals(ref.getScriptLocation()) && + testRef.getTargetName().equals(ref.getTargetName()) && testRef.getCleanTargetName().equals(ref.getCleanTargetName())) { // Match on other fields. Return without changing anything. return false; @@ -348,17 +349,17 @@ * Acquires write access. * @param foreignProjectName the local name of the foreign project * (usually its code name) - * @param targetName the name of the Ant target corresponding to the build artifact + * @param id the ID of the build artifact (usually build target name) * @return true if a reference or some property was actually removed, * false if the reference was not there and no property was removed */ - public boolean removeReference(final String foreignProjectName, final String targetName) { + public boolean removeReference(final String foreignProjectName, final String id) { return ((Boolean)ProjectManager.mutex().writeAccess(new Mutex.Action() { public Object run() { Element references = loadReferences(true); boolean success; try { - success = removeRawReference(foreignProjectName, targetName, references); + success = removeRawReference(foreignProjectName, id, references); } catch (IllegalArgumentException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); return Boolean.FALSE; @@ -393,7 +394,7 @@ } } } - String refProp = "reference." + foreignProjectName + '.' + targetName; // NOI18N + String refProp = "reference." + foreignProjectName + '.' + id; // NOI18N for (int i = 0; i < PROPS_PATHS.length; i++) { EditableProperties props = h.getProperties(PROPS_PATHS[i]); if (props.containsKey(refProp)) { @@ -454,16 +455,16 @@ * Acquires write access. * @param foreignProjectName the local name of the foreign project * (usually its code name) - * @param targetName the name of the Ant target corresponding to the build artifact + * @param id the ID of the build artifact (usually build target name) * @return true if a reference was actually removed, false if it was not there */ - public boolean removeRawReference(final String foreignProjectName, final String targetName) { + public boolean removeRawReference(final String foreignProjectName, final String id) { return ((Boolean)ProjectManager.mutex().writeAccess(new Mutex.Action() { public Object run() { Element references = loadReferences(true); boolean success; try { - success = removeRawReference(foreignProjectName, targetName, references); + success = removeRawReference(foreignProjectName, id, references); } catch (IllegalArgumentException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); return Boolean.FALSE; @@ -478,7 +479,7 @@ })).booleanValue(); } - private static boolean removeRawReference(String foreignProjectName, String targetName, Element references) throws IllegalArgumentException { + private static boolean removeRawReference(String foreignProjectName, String id, Element references) throws IllegalArgumentException { // As with addRawReference, do a linear search through. List/**/subEls = Util.findSubElements(references); Iterator it = subEls.iterator(); @@ -490,11 +491,11 @@ return false; } if (testRef.getForeignProjectName().equals(foreignProjectName)) { - if (testRef.getTargetName().compareTo(targetName) > 0) { + if (testRef.getID().compareTo(id) > 0) { // again, searched past it return false; } - if (testRef.getTargetName().equals(targetName)) { + if (testRef.getID().equals(id)) { // Key match, remove it. references.removeChild(testRefEl); return true; @@ -547,17 +548,17 @@ * Acquires read access. * @param foreignProjectName the local name of the foreign project * (usually its code name) - * @param targetName the name of the Ant target corresponding to the build artifact + * @param id the ID of the build artifact (usually the build target name) * @return the specified raw reference from this project, * or null if none such could be found */ - public RawReference getRawReference(final String foreignProjectName, final String targetName) { + public RawReference getRawReference(final String foreignProjectName, final String id) { return (RawReference)ProjectManager.mutex().readAccess(new Mutex.Action() { public Object run() { Element references = loadReferences(false); if (references != null) { try { - return getRawReference(foreignProjectName, targetName, references); + return getRawReference(foreignProjectName, id, references); } catch (IllegalArgumentException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } @@ -567,13 +568,13 @@ }); } - private static RawReference getRawReference(String foreignProjectName, String targetName, Element references) throws IllegalArgumentException { + private static RawReference getRawReference(String foreignProjectName, String id, Element references) throws IllegalArgumentException { List/**/subEls = Util.findSubElements(references); Iterator it = subEls.iterator(); while (it.hasNext()) { RawReference ref = RawReference.create((Element)it.next()); if (ref.getForeignProjectName().equals(foreignProjectName) && - ref.getTargetName().equals(targetName)) { + ref.getID().equals(id)) { return ref; } } @@ -709,7 +710,7 @@ public String createForeignFileReference(AntArtifact artifact) throws IllegalArgumentException { addReference(artifact); String projID = findReferenceID(artifact); - return "${reference." + projID + '.' + artifact.getTargetName() + '}'; // NOI18N + return "${reference." + projID + '.' + artifact.getID() + '}'; // NOI18N } private static final Pattern FOREIGN_FILE_REFERENCE = Pattern.compile("\\$\\{reference\\.([^.${}]+)\\.([^.${}]+)\\}"); // NOI18N @@ -762,8 +763,8 @@ Matcher m = FOREIGN_FILE_REFERENCE.matcher(reference); if (m.matches()) { String forProjName = m.group(1); - String targetName = m.group(2); - removeReference(forProjName, targetName); + String id = m.group(2); + removeReference(forProjName, id); return; } m = FOREIGN_PLAIN_FILE_REFERENCE.matcher(reference); @@ -804,6 +805,7 @@ private final URI scriptLocation; private final String targetName; private final String cleanTargetName; + private final String artifactID; /** * Create a raw reference descriptor. @@ -813,9 +815,10 @@ * @param scriptLocation the relative URI to the build script from the project directory * @param targetName the Ant target name * @param cleanTargetName the Ant clean target name + * @param artifactID the {@link AntArtifact#getID ID} of the build artifact * @throws IllegalArgumentException if the script location is given an absolute URI */ - public RawReference(String foreignProjectName, String artifactType, URI scriptLocation, String targetName, String cleanTargetName) throws IllegalArgumentException { + public RawReference(String foreignProjectName, String artifactType, URI scriptLocation, String targetName, String cleanTargetName, String artifactID) throws IllegalArgumentException { this.foreignProjectName = foreignProjectName; this.artifactType = artifactType; if (scriptLocation.isAbsolute()) { @@ -824,6 +827,7 @@ this.scriptLocation = scriptLocation; this.targetName = targetName; this.cleanTargetName = cleanTargetName; + this.artifactID = artifactID; } private static final List/**/ SUB_ELEMENT_NAMES = Arrays.asList(new String[] { @@ -832,6 +836,7 @@ "script", // NOI18N "target", // NOI18N "clean-target", // NOI18N + "id", // NOI18N }); /** @@ -843,11 +848,11 @@ throw new IllegalArgumentException("bad element name: " + xml); // NOI18N } NodeList nl = xml.getElementsByTagNameNS("*", "*"); // NOI18N - if (nl.getLength() != 5) { + if (nl.getLength() != 6) { throw new IllegalArgumentException("missing or extra data: " + xml); // NOI18N } - String[] values = new String[5]; - for (int i = 0; i < 5; i++) { + String[] values = new String[nl.getLength()]; + for (int i = 0; i < nl.getLength(); i++) { Element el = (Element)nl.item(i); if (!REFS_NS.equals(el.getNamespaceURI())) { throw new IllegalArgumentException("bad subelement ns: " + el); // NOI18N @@ -868,7 +873,7 @@ } assert !Arrays.asList(values).contains(null); URI scriptLocation = URI.create(values[2]); // throws IllegalArgumentException - return new RawReference(values[0], values[1], scriptLocation, values[3], values[4]); + return new RawReference(values[0], values[1], scriptLocation, values[3], values[4], values[5]); } /** @@ -882,8 +887,9 @@ scriptLocation.toString(), targetName, cleanTargetName, + artifactID, }; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 6; i++) { Element subel = ownerDocument.createElementNS(REFS_NS, (String)SUB_ELEMENT_NAMES.get(i)); subel.appendChild(ownerDocument.createTextNode(values[i])); el.appendChild(subel); @@ -939,6 +945,15 @@ } /** + * Get the ID of the foreign project's build artifact. + * See also {@link AntArtifact#getID}. + * @return the artifact identifier + */ + public String getID() { + return artifactID; + } + + /** * Attempt to convert this reference to a live artifact object. * This involves finding the referenced foreign project on disk * (among standard project and private properties) and asking it @@ -981,13 +996,13 @@ // Was not a project dir. return null; } - return AntArtifactQuery.findArtifactByTarget(p, targetName); + return AntArtifactQuery.findArtifactByID(p, artifactID); } }); } public String toString() { - return "ReferenceHelper.RawReference<" + foreignProjectName + "," + artifactType + "," + scriptLocation + "," + targetName + "," + cleanTargetName + ">"; // NOI18N + return "ReferenceHelper.RawReference<" + foreignProjectName + "," + artifactType + "," + scriptLocation + "," + targetName + "," + cleanTargetName + "," + artifactID + ">"; // NOI18N } } Index: test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java =================================================================== RCS file: /cvs/ant/project/test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java,v retrieving revision 1.7 diff -u -r1.7 ReferenceHelperTest.java --- test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java 25 Apr 2004 16:43:39 -0000 1.7 +++ test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java 12 May 2004 16:06:48 -0000 @@ -175,19 +175,20 @@ public void testRawReferenceManipulation() throws Exception { assertEquals("starting with no raw references", Collections.EMPTY_LIST, Arrays.asList(r.getRawReferences())); // Test simple adding of a reference. - ReferenceHelper.RawReference ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean"); + ReferenceHelper.RawReference ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean", "dojarID"); assertTrue("successfully added a raw ref to otherproj.dojar", r.addRawReference(ref)); assertNull("project.properties not changed", pev.getProperty("project.otherproj")); assertTrue("project is modified", pm.isModified(p)); - ref = r.getRawReference("otherproj", "dojar"); + ref = r.getRawReference("otherproj", "dojarID"); assertNotNull("found otherproj.dojar", ref); assertEquals("correct foreign project name", "otherproj", ref.getForeignProjectName()); assertEquals("correct artifact type", "jar", ref.getArtifactType()); assertEquals("correct script location", URI.create("build.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean", ref.getCleanTargetName()); + assertEquals("correct ID name", "dojarID", ref.getID()); // Nonexistent references are not returned. - ref = r.getRawReference("otherproj2", "dojar"); + ref = r.getRawReference("otherproj2", "dojarID"); assertNull("no such ref otherproj2.dojar", ref); ref = r.getRawReference("otherproj", "dojar2"); assertNull("no such ref otherproj.dojar2", ref); @@ -202,24 +203,25 @@ assertEquals("correct script location", URI.create("build.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean", ref.getCleanTargetName()); + assertEquals("correct ID name", "dojarID", ref.getID()); // Test removing it. - assertTrue("successfully removed otherproj.dojar", r.removeRawReference("otherproj", "dojar")); + assertTrue("successfully removed otherproj.dojar", r.removeRawReference("otherproj", "dojarID")); refs = r.getRawReferences(); assertEquals("no references here", 0, refs.length); ref = r.getRawReference("otherproj", "dojar"); assertNull("otherproj.dojar is gone", ref); // Test adding several references. - ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean"); + ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean", "dojarID"); assertTrue("added ref to otherproj.dojar", r.addRawReference(ref)); - ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar2", "clean"); + ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar2", "clean", "dojar2ID"); assertTrue("added ref to otherproj.dojar2", r.addRawReference(ref)); - ref = new ReferenceHelper.RawReference("otherproj2", "ear", URI.create("build.xml"), "dojar", "clean"); + ref = new ReferenceHelper.RawReference("otherproj2", "ear", URI.create("build.xml"), "dojar", "clean", "dojarID"); assertTrue("added ref to otherproj2.dojar", r.addRawReference(ref)); assertEquals("have three refs", 3, r.getRawReferences().length); // Test no-op adds and removes. pm.saveProject(p); assertFalse("project is saved", pm.isModified(p)); - ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean"); + ref = new ReferenceHelper.RawReference("otherproj", "jar", URI.create("build.xml"), "dojar", "clean", "dojarID"); assertFalse("already had ref to otherproj.dojar", r.addRawReference(ref)); assertFalse("project is not modified by no-op add", pm.isModified(p)); assertEquals("still have three refs", 3, r.getRawReferences().length); @@ -227,34 +229,36 @@ assertFalse("project is not modified by no-op remove", pm.isModified(p)); assertEquals("still have three refs", 3, r.getRawReferences().length); // Test modifications. - ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build.xml"), "dojar", "clean"); + ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build.xml"), "dojar", "clean", "dojarID"); assertTrue("modified ref to otherproj.dojar", r.addRawReference(ref)); assertTrue("project is modified by changed ref", pm.isModified(p)); assertEquals("still have three refs", 3, r.getRawReferences().length); - ref = r.getRawReference("otherproj", "dojar"); + ref = r.getRawReference("otherproj", "dojarID"); assertEquals("correct foreign project name", "otherproj", ref.getForeignProjectName()); assertEquals("correct modified artifact type", "war", ref.getArtifactType()); assertEquals("correct script location", URI.create("build.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean", ref.getCleanTargetName()); - ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build2.xml"), "dojar", "clean"); + assertEquals("correct ID name", "dojarID", ref.getID()); + ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build2.xml"), "dojar", "clean", "dojarID"); assertTrue("modified ref to otherproj.dojar", r.addRawReference(ref)); - ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build2.xml"), "dojar", "clean2"); + ref = new ReferenceHelper.RawReference("otherproj", "war", URI.create("build2.xml"), "dojar", "clean2", "dojarID"); assertTrue("modified ref to otherproj.dojar", r.addRawReference(ref)); - ref = r.getRawReference("otherproj", "dojar"); + ref = r.getRawReference("otherproj", "dojarID"); assertEquals("correct foreign project name", "otherproj", ref.getForeignProjectName()); assertEquals("correct modified artifact type", "war", ref.getArtifactType()); assertEquals("correct script location", URI.create("build2.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean2", ref.getCleanTargetName()); + assertEquals("correct ID name", "dojarID", ref.getID()); assertEquals("still have three refs", 3, r.getRawReferences().length); // More removals and adds. - assertTrue("now removing otherproj.dojar2", r.removeRawReference("otherproj", "dojar2")); - assertNull("otherproj.dojar2 is gone", r.getRawReference("otherproj", "dojar2")); - assertNotNull("otherproj.jar is still there", r.getRawReference("otherproj", "dojar")); - assertNotNull("otherproj2.dojar is still there", r.getRawReference("otherproj2", "dojar")); + assertTrue("now removing otherproj.dojar2", r.removeRawReference("otherproj", "dojar2ID")); + assertNull("otherproj.dojar2 is gone", r.getRawReference("otherproj", "dojar2ID")); + assertNotNull("otherproj.jar is still there", r.getRawReference("otherproj", "dojarID")); + assertNotNull("otherproj2.dojar is still there", r.getRawReference("otherproj2", "dojarID")); assertEquals("down to two refs", 2, r.getRawReferences().length); - ref = new ReferenceHelper.RawReference("aardvark", "jar", URI.create("build.xml"), "jar", "clean"); + ref = new ReferenceHelper.RawReference("aardvark", "jar", URI.create("build.xml"), "jar", "clean", "jarID"); assertTrue("added ref to aardvark.jar", r.addRawReference(ref)); // Check list of refs. refs = r.getRawReferences(); @@ -266,18 +270,21 @@ assertEquals("correct script location", URI.create("build.xml"), ref.getScriptLocation()); assertEquals("correct target name", "jar", ref.getTargetName()); assertEquals("correct clean target name", "clean", ref.getCleanTargetName()); + assertEquals("correct ID name", "jarID", ref.getID()); ref = refs[1]; assertEquals("correct foreign project name", "otherproj", ref.getForeignProjectName()); assertEquals("correct modified artifact type", "war", ref.getArtifactType()); assertEquals("correct script location", URI.create("build2.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean2", ref.getCleanTargetName()); + assertEquals("correct ID name", "dojarID", ref.getID()); ref = refs[2]; assertEquals("correct foreign project name", "otherproj2", ref.getForeignProjectName()); assertEquals("correct modified artifact type", "ear", ref.getArtifactType()); assertEquals("correct script location", URI.create("build.xml"), ref.getScriptLocation()); assertEquals("correct target name", "dojar", ref.getTargetName()); assertEquals("correct clean target name", "clean", ref.getCleanTargetName()); + assertEquals("correct ID name", "dojarID", ref.getID()); // Try saving and checking that project.xml is correct. assertTrue("Project is still modified", pm.isModified(p)); pm.saveProject(p); @@ -294,6 +301,7 @@ "script", "target", "clean-target", + "id", }; String[][] values = { { @@ -302,6 +310,7 @@ "build.xml", "jar", "clean", + "jarID", }, { "otherproj", @@ -309,6 +318,7 @@ "build2.xml", "dojar", "clean2", + "dojarID", }, { "otherproj2", @@ -316,11 +326,12 @@ "build.xml", "dojar", "clean", + "dojarID", }, }; for (int i = 0; i < 3; i++) { Element reference = (Element)nl.item(i); - for (int j = 0; j < 5; j++) { + for (int j = 0; j < 6; j++) { String elementName = elementNames[j]; Element element = Util.findElement(reference, elementName, ReferenceHelper.REFS_NS); assertNotNull("had element " + elementName + " in ref #" + i, element); @@ -549,7 +560,7 @@ // test non-collocated foreign project reference FileObject nonCollocatedProjectLib = scratch.getFileObject("separate/proj3").createFolder("dist").createData("proj3.jar"); f = FileUtil.toFile(nonCollocatedProjectLib); - art = AntArtifactQuery.findArtifactByTarget(pm.findProject(sepprojdir), "dojar"); + art = AntArtifactQuery.findArtifactByID(pm.findProject(sepprojdir), "dojar"); assertNotNull("have an artifact proj3.dojar", art); assertEquals("can add a reference to a direct artifact", "${reference.proj3.dojar}", r.createForeignFileReference(art)); assertEquals("creating reference second time must return already existing ID", "${reference.proj3.dojar}", r.createForeignFileReference(art)); @@ -634,7 +645,7 @@ public void testToAntArtifact() throws Exception { ReferenceHelper.RawReference ref = new ReferenceHelper.RawReference( - "proj2", "irrelevant", new URI("also-irrelevant"), "dojar", "totally-irrelevant"); + "proj2", "irrelevant", new URI("also-irrelevant"), "dojar", "totally-irrelevant", "dojar"); AntArtifact art = ref.toAntArtifact(r); assertNull("${project.proj2} not set, will not be found", art); EditableProperties props = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); @@ -648,7 +659,7 @@ assertEquals("correct target name", "dojar", art.getTargetName()); assertEquals("correct clean target name", "clean", art.getCleanTargetName()); ref = new ReferenceHelper.RawReference( - "proj2", "irrelevant", new URI("also-irrelevant"), "doojar", "totally-irrelevant"); + "proj2", "irrelevant", new URI("also-irrelevant"), "doojar", "totally-irrelevant", "doojar"); art = ref.toAntArtifact(r); assertNull("wrong target name, will not be found", art); }