Пример #1
0
  /** Check if the getSubBuilders properly predicts the output. */
  public static void testSubBuilders() throws Exception {
    Workspace ws = Workspace.getWorkspace(new File("test/ws"));
    Project project = ws.getProject("p4-sub");

    Collection<? extends Builder> bs = project.getSubBuilders();
    assertNotNull(bs);
    assertEquals(3, bs.size());
    Set<String> names = new HashSet<String>();
    for (Builder b : bs) {
      names.add(b.getBsn());
    }
    assertTrue(names.contains("p4-sub.a"));
    assertTrue(names.contains("p4-sub.b"));
    assertTrue(names.contains("p4-sub.c"));

    File[] files = project.build();
    assertTrue(project.check());

    System.err.println(Processor.join(project.getErrors(), "\n"));
    System.err.println(Processor.join(project.getWarnings(), "\n"));
    assertEquals(0, project.getErrors().size());
    assertEquals(0, project.getWarnings().size());
    assertNotNull(files);
    assertEquals(3, files.length);
    for (File file : files) {
      Jar jar = new Jar(file);
      Manifest m = jar.getManifest();
      assertTrue(names.contains(m.getMainAttributes().getValue("Bundle-SymbolicName")));
    }
  }
Пример #2
0
 /** Duplicates in runbundles gave a bad error, should be ignored */
 public static void testRunbundleDuplicates() throws Exception {
   Workspace ws = new Workspace(new File("test/ws"));
   Project top = ws.getProject("p1");
   top.clear();
   top.setProperty("-runbundles", "org.apache.felix.configadmin,org.apache.felix.configadmin");
   Collection<Container> runbundles = top.getRunbundles();
   assertTrue(top.check("Multiple bundles with the same final URL"));
   assertNotNull(runbundles);
   assertEquals(1, runbundles.size());
 }
Пример #3
0
 /** Test 2 equal bsns but diff. versions */
 public static void testSameBsnRunBundles() throws Exception {
   Workspace ws = new Workspace(new File("test/ws"));
   Project top = ws.getProject("p1");
   top.setProperty(
       "-runbundles",
       "org.apache.felix.configadmin;version='[1.0.1,1.0.1]',org.apache.felix.configadmin;version='[1.1.0,1.1.0]'");
   Collection<Container> runbundles = top.getRunbundles();
   assertTrue(top.check());
   assertNotNull(runbundles);
   assertEquals(2, runbundles.size());
 }
Пример #4
0
 /** Test bnd.bnd of project `foo`: `-runbundles: foo;version=latest` */
 public static void testRunBundlesContainsSelf() throws Exception {
   Workspace ws = new Workspace(new File("test/ws"));
   Project top = ws.getProject("p1");
   top.setProperty("-runbundles", "p1;version=latest");
   top.setChanged();
   top.isStale();
   Collection<Container> runbundles = top.getRunbundles();
   assertTrue(top.check("Circular dependency"));
   assertNotNull(runbundles);
   assertEquals(0, runbundles.size());
 }
Пример #5
0
 /**
  * Test if you can add directories and files to the classpath. Originally checked only for files
  */
 public static void testAddDirToClasspath() throws Exception {
   Workspace ws = new Workspace(new File("test/ws"));
   Project top = ws.getProject("p1");
   top.addClasspath(top.getOutput());
   assertTrue(top.check());
 }
Пример #6
0
 /** #194 StackOverflowError when -runbundles in bnd.bnd refers to itself */
 public static void testProjectReferringToItself() throws Exception {
   Workspace ws = new Workspace(new File("test/ws"));
   Project top = ws.getProject("bug194");
   top.addClasspath(top.getOutput());
   assertTrue(top.check("Circular dependency context"));
 }