Пример #1
0
  @Test(dataProvider = "binary")
  public void testBuild(boolean parallelUploads) throws Exception {
    final File cache = new File(dir, ".anvil/cache");
    final File slug = new File(dir, ".anvil/slug");

    assertFalse(cache.exists());
    assertFalse(slug.exists());

    Manifest m = new Manifest(dir);
    m.addAll();

    final int[] uploadCounterHolder = new int[] {0};
    config.setParallelUploads(parallelUploads);
    config
        .getEventSubscription()
        .subscribe(
            Janvil.Event.UPLOADS_END,
            new EventSubscription.Subscriber<Janvil.Event>() {
              public void handle(Janvil.Event event, Object data) {
                uploadCounterHolder[0] = Integer.valueOf(data.toString());
              }
            });
    new Janvil(config).build(m);

    assertTrue(cache.exists());
    assertFalse(slug.exists());
    assertEquals(uploadCounterHolder[0], sampleFileIterations);
  }
Пример #2
0
 @Test
 public void testBuildFailure() throws Exception {
   Manifest m = new Manifest(dir);
   m.addAll();
   try {
     janvil.build(m, Collections.<String, String>emptyMap(), "INVALID_BUILDPACK");
     fail();
   } catch (JanvilBuildException e) {
     assertEquals(1, e.getExitStatus());
   }
 }