Package org.springsource.loaded

Examples of org.springsource.loaded.ReloadableType


  @Test
  public void verifyingAssociatedTypesInfo2() throws Exception {
    // associatedtypes (top and middle) are in the super loader
    // subassociatedtypes (bottom) are in the sub loader
       
    ReloadableType bm = subLoader.loadAsReloadableType("associatedtypes.CM");

    ReloadableType cm = subLoader.loadAsReloadableType("associatedtypes.CM");
    assertNotNull(cm);
    assertNotEquals(subLoader,cm.getClazz().getClassLoader());
    ReloadableType im1 = subLoader.loadAsReloadableType("associatedtypes.IM");
    assertNotNull(im1);
   
    runUnguarded(cm.getClazz(), "run"); // Cause clinit to run so associations are setup

    assertContains("associatedtypes.CM", toString(im1.getAssociatedSubtypes()));
    assertFalse(cm.isAffectedByReload());
    assertFalse(cm.isAffectedByReload());
    assertFalse(bm.isAffectedByReload());
   
    // Load CM again, should tag CM and IM
    cm.loadNewVersion("2",cm.bytesInitial);
   
    assertTrue(cm.isAffectedByReload());
    assertTrue(im1.isAffectedByReload());
    assertTrue(bm.isAffectedByReload());
  }
View Full Code Here


    for (int i=0;i<list.size();i++) {
      if (i>0) {
        b.append(",");
      }
      Reference<ReloadableType> ref = list.get(i);
      ReloadableType rtype = ref.get();
      if (rtype!=null) {
        b.append(rtype.getName());
      }
    }
    b.append("]");
    return b.toString();
  }
View Full Code Here

    binLoader = new SubLoader(new String[] {}, new String[] { "../testdata/lib/cglib-nodep-2.2.jar" });
    subLoader = (SubLoader) binLoader;

    String t = "subpkg.ProxyTestcase";

    ReloadableType proxyTestcaseR = subLoader.loadAsReloadableType(t);

    result = runUnguarded(proxyTestcaseR.getClazz(), "run");
    System.out.println(result);

    result = runUnguarded(proxyTestcaseR.getClazz(), "getProxyLoader");
    System.out.println(result.returnValue);

    result = runUnguarded(proxyTestcaseR.getClazz(), "getSimpleLoader");
    System.out.println(result.returnValue);

    //    Class<?> clazz = binLoader.loadClass(t);
    //
    //    runMethodAndCollectOutput(clazz, "configureTest1");
View Full Code Here

  // use those sparse arrays and ID numbers more so that type lookups can be quicker.  Once we truly discover the right super type reference from a subtype, fill it in in the array
  // optimize for the case where there will only be one type around of a given name *usually*
 
  @Test
  public void github34() throws Exception {
    ReloadableType rtypeA = subLoader.loadAsReloadableType("issue34.Implementation3");
    result = runUnguarded(rtypeA.getClazz(), "run");
    assertEquals("Hello World!", result.stdout);

//    ReloadableType rtypeB = subLoader.loadAsReloadableType("subpkg.Bottom");
//    result = runUnguarded(rtypeB.getClazz(), "m");
//    assertEquals("Bottom.m() running", result.stdout);
View Full Code Here

    checkDoesNotContain(typeDescriptor, "privateMethod");
    checkDoesContain(typeDescriptor, "0x1 publicMethod");
    checkDoesContain(typeDescriptor, "0x1 protectedMethod");
    checkDoesContain(typeDescriptor, "0x1 defaultMethod");

    ReloadableType rtype = typeRegistry.addType("catchers.B", loadBytesForClass("catchers.B"));

    reload(rtype, "2");
  }
View Full Code Here

  @Test
  public void exerciseCatcher() throws Exception {
    TypeRegistry registry = getTypeRegistry("catchers..*");
    String a = "catchers.A";
    String b = "catchers.B";
    ReloadableType rtypeA = registry.addType(a, loadBytesForClass(a));
    ReloadableType rtypeB = registry.addType(b, loadBytesForClass(b));

    Class<?> clazz = loadit("catchers.Runner", ClassRenamer.rename("catchers.Runner", loadBytesForClass("catchers.Runner")));

    assertStartsWith("catchers.B@", runUnguarded(clazz, "runToString").returnValue);
    Assert.assertEquals(65, runUnguarded(clazz, "runPublicMethod").returnValue);
    Assert.assertEquals(23, runUnguarded(clazz, "runProtectedMethod").returnValue);

    rtypeB.loadNewVersion("2", retrieveRename(b, b + "2"));

    Assert.assertEquals("hey!", runUnguarded(clazz, "runToString").returnValue);
    Assert.assertEquals(66, runUnguarded(clazz, "runPublicMethod").returnValue);
    Assert.assertEquals(32, runUnguarded(clazz, "runProtectedMethod").returnValue);

View Full Code Here

    String x = "catchers.X";
    String y = "catchers.Y";
    String z = "catchers.Z";

    ReloadableType rtypeX = registry.addType(x, loadBytesForClass(x));
    ReloadableType rtypeY = registry.addType(y, loadBytesForClass(y));
    ReloadableType rtypeZ = registry.addType(z, loadBytesForClass(z));

    Class<?> clazz = loadRunner("catchers.Runner2");

    Assert.assertEquals(1, runUnguarded(clazz, "runPublicX").returnValue);
    Assert.assertEquals(1, runUnguarded(clazz, "runPublicY").returnValue); // Y does not override
View Full Code Here

  @Test
  public void reloadDefaultVisInner() throws Exception {
    TypeRegistry typeRegistry = getTypeRegistry("inners..*");

    typeRegistry.addType("inners.One$Inner", loadBytesForClass("inners.One$Inner"));
    ReloadableType rtype = typeRegistry.addType("inners.One", loadBytesForClass("inners.One"));
    runUnguarded(rtype.getClazz(), "runner");

    rtype.loadNewVersion("2", retrieveRename("inners.One", "inners.One2", "inners.One2$Inner:inners.One$Inner"));
    runUnguarded(rtype.getClazz(), "runner");
  }
View Full Code Here

  public void reloadDefaultVisClass() throws Exception {
    String tclass = "inners.Two";
    TypeRegistry typeRegistry = getTypeRegistry("inners..*");

    typeRegistry.addType("inners.TwoDefault", loadBytesForClass("inners.TwoDefault"));
    ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));
    runUnguarded(rtype.getClazz(), "runner");

    rtype.loadNewVersion("2", retrieveRename(tclass, tclass + "2"));
    runUnguarded(rtype.getClazz(), "runner");
  }
View Full Code Here

  public void reloadPrivateVisInner() throws Exception {
    String tclass = "inners.Three";
    TypeRegistry typeRegistry = getTypeRegistry("inners..*");
   
   
    ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));
    runUnguarded(rtype.getClazz(), "runner");

//    ReloadableType rtypeInner =
    typeRegistry.addType("inners.Three$Inner", retrieveRename("inners.Three$Inner", "inners.Three2$Inner","inners.Three2:inners.Three"));

    rtype.loadNewVersion("2", retrieveRename(tclass, tclass + "2", "inners.Three2$Inner:inners.Three$Inner","inners.Three2:inners.Three"));
    runUnguarded(rtype.getClazz(), "runner");
  }
View Full Code Here

TOP

Related Classes of org.springsource.loaded.ReloadableType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.