@Test
  public void testUpdateHostToFragment() throws Exception {
    Bundle bundleA = installBundle(getHostA());
    try {
      bundleA.start();
      assertBundleState(Bundle.ACTIVE, bundleA.getState());
      BundleRevisions brevs = bundleA.adapt(BundleRevisions.class);
      assertEquals(1, brevs.getRevisions().size());
      BundleRevision brev = brevs.getRevisions().get(0);
      assertEquals(0, brev.getTypes());

      bundleA.update(toInputStream(getFragmentA()));
      brevs = bundleA.adapt(BundleRevisions.class);
      Assert.assertNotSame(brev, brevs.getRevisions().get(0));
      brev = brevs.getRevisions().get(0);
      assertEquals(BundleRevision.TYPE_FRAGMENT, brev.getTypes());
    } finally {
      bundleA.uninstall();
    }
  }
Ejemplo n.º 2
0
 public static BundleRevisionDTO[] newArrayBundleRevisionDTO(BundleRevisions revisions) {
   if (revisions == null) {
     return null;
   }
   List<BundleRevision> revs = revisions.getRevisions();
   final int size = revs.size();
   BundleRevisionDTO[] dtos = new BundleRevisionDTO[size];
   for (int i = 0; i < size; i++) {
     dtos[i] = new DTOBuilder().getBundleRevisionDTO(revs.get(i));
   }
   return dtos;
 }
Ejemplo n.º 3
0
 public static BundleWiringDTO[] newArrayBundleWiringDTO(BundleRevisions revisions) {
   if (revisions == null) {
     return null;
   }
   List<BundleRevision> revs = revisions.getRevisions();
   final int size = revs.size();
   List<BundleWiringDTO> dtos = new ArrayList<BundleWiringDTO>(size);
   for (int i = 0; i < size; i++) {
     BundleWiring wiring = revs.get(i).getWiring();
     if (wiring != null) {
       dtos.add(
           new DTOBuilder().getBundleWiringDTO(wiring)); // use new DTOBuilder for each wiring dto
     }
   }
   return dtos.toArray(new BundleWiringDTO[dtos.size()]);
 }