1 19 20 package org.netbeans.modules.apisupport.project.queries; 21 22 import java.net.URI ; 23 import java.util.Arrays ; 24 import java.util.Collections ; 25 import java.util.Properties ; 26 import org.netbeans.api.java.project.JavaProjectConstants; 27 import org.netbeans.api.project.ProjectManager; 28 import org.netbeans.api.project.ant.AntArtifact; 29 import org.netbeans.api.project.ant.AntArtifactQuery; 30 import org.netbeans.modules.apisupport.project.NbModuleProject; 31 import org.netbeans.modules.apisupport.project.TestBase; 32 import org.openide.filesystems.FileObject; 33 34 38 public class AntArtifactProviderImplTest extends TestBase { 39 40 public AntArtifactProviderImplTest(String name) { 41 super(name); 42 } 43 44 private NbModuleProject javaProjectProject; 45 private NbModuleProject loadersProject; 46 47 protected void setUp() throws Exception { 48 super.setUp(); 49 FileObject dir = nbCVSRoot().getFileObject("java/project"); 50 assertNotNull("have java/project checked out", dir); 51 javaProjectProject = (NbModuleProject) ProjectManager.getDefault().findProject(dir); 52 dir = nbCVSRoot().getFileObject("openide/loaders"); 53 assertNotNull("have openide/loaders checked out", dir); 54 loadersProject = (NbModuleProject) ProjectManager.getDefault().findProject(dir); 55 } 56 57 public void testJARFileIsProduced() throws Exception { 58 AntArtifact[] arts = AntArtifactQuery.findArtifactsByType(loadersProject, JavaProjectConstants.ARTIFACT_TYPE_JAR); 59 assertEquals("one artifact produced", 1, arts.length); 60 assertEquals("correct project", loadersProject, arts[0].getProject()); 61 assertEquals("correct type", JavaProjectConstants.ARTIFACT_TYPE_JAR, arts[0].getType()); 62 assertEquals("correct ID", "module", arts[0].getID()); 63 assertEquals("correct location", 64 Collections.singletonList(URI.create("../../nbbuild/netbeans/" + TestBase.CLUSTER_PLATFORM + "/modules/org-openide-loaders.jar")), 65 Arrays.asList(arts[0].getArtifactLocations())); 66 assertEquals("correct script", nbCVSRoot().getFileObject("openide/loaders/build.xml"), arts[0].getScriptFile()); 67 assertEquals("correct build target", "netbeans", arts[0].getTargetName()); 68 assertEquals("correct clean target", "clean", arts[0].getCleanTargetName()); 69 assertEquals("no properties", new Properties (), arts[0].getProperties()); 70 arts = AntArtifactQuery.findArtifactsByType(javaProjectProject, JavaProjectConstants.ARTIFACT_TYPE_JAR); 71 assertEquals("one artifact produced", 1, arts.length); 72 assertEquals("correct location", 73 Collections.singletonList(URI.create("../../nbbuild/netbeans/" + TestBase.CLUSTER_IDE + "/modules/org-netbeans-modules-java-project.jar")), 74 Arrays.asList(arts[0].getArtifactLocations())); 75 } 76 77 } 78 | Popular Tags |