Package org.springsource.loaded

Examples of org.springsource.loaded.ReloadableType.loadNewVersion()


    assertEquals(2, typeRegistry.getChildClassLoader().getDefinedCount());

    tTwo.loadNewVersion("002", tTwo.bytesInitial);
    assertEquals(4, typeRegistry.getChildClassLoader().getDefinedCount());

    tThree.loadNewVersion("002", tThree.bytesInitial);
    assertEquals(6, typeRegistry.getChildClassLoader().getDefinedCount());
  }
}
View Full Code Here


    String t = "clinitg.Three";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1", result.returnValue);
    rtype.loadNewVersion("3", retrieveRename(t, t + "3"));
    // Dont need to do this - think that is because of some of the constant
View Full Code Here

    assertEquals("1", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1", result.returnValue);
    rtype.loadNewVersion("3", retrieveRename(t, t + "3"));
    // Dont need to do this - think that is because of some of the constant
    // reinit stuff we already
    // drive in groovy
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
View Full Code Here

    // ReloadableType rtype2 =
    typeRegistry.addType(t2, loadBytesForClass(t2));
    typeRegistry.getClassLoader().loadClass(t); // load it but do not initialize it
    captureOn();
    byte[] renamed = retrieveRename(t, t + "2");
    rtype.loadNewVersion("2", renamed); // reload it, this will trigger initialization
    String s = captureOffReturnStdout();
    assertEquals("1a", s);

    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1312", result.stdout);
View Full Code Here

    TypeRegistry typeRegistry = getTypeRegistry("data.HelloWorld");
    ReloadableType rtype = typeRegistry.addType("data.HelloWorld", loadBytesForClass("data.HelloWorld"));
    runUnguarded(rtype.getClazz(), "greet");

    // Just transform the existing version into a dispatcher/executor
    rtype.loadNewVersion("000", rtype.bytesInitial);
    Assert.assertEquals("Greet from HelloWorld", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorld", "data.HelloWorld002"));
    Assert.assertEquals("Greet from HelloWorld 2", runUnguarded(rtype.getClazz(), "greet").stdout);
View Full Code Here

    // Just transform the existing version into a dispatcher/executor
    rtype.loadNewVersion("000", rtype.bytesInitial);
    Assert.assertEquals("Greet from HelloWorld", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorld", "data.HelloWorld002"));
    Assert.assertEquals("Greet from HelloWorld 2", runUnguarded(rtype.getClazz(), "greet").stdout);
    //    ClassPrinter.print(rtype.getLatestExecutorBytes());
    //    ClassPrinter.print(rtype.bytesInitial);

  }
View Full Code Here

    Result r = runUnguarded(simpleClass, "foo");

    r = runUnguarded(simpleClass, "getValue");
    assertEquals(5, r.returnValue);

    rtype.loadNewVersion("002", retrieveRename("basic.Basic", "basic.Basic002"));

    r = runUnguarded(simpleClass, "getValue");
    assertEquals(7, r.returnValue);
  }
View Full Code Here

    ReloadableType rtype = typeRegistry.addType(t, sc);

    Class<?> clazz = rtype.getClazz();
    runUnguarded(clazz, "time");

    rtype.loadNewVersion("002", retrieveRename(t, "remote.Perf2"));

    runUnguarded(clazz, "time");
  }
 
  @Test
View Full Code Here

        toString(runOnInstance(rtype.getClazz(), instance, "getProtectedArrayOfArrayOfLongs").returnValue));

    runOnInstance(rtype.getClazz(), instance, "setProtectedStaticField", 3);
    assertEquals(3, runOnInstance(rtype.getClazz(), instance, "getProtectedStaticField").returnValue);

    rtype.loadNewVersion(rtype.bytesInitial);

    runOnInstance(rtype.getClazz(), instance, "setPublicField", 4);
    assertEquals(4, runOnInstance(rtype.getClazz(), instance, "getPublicField").returnValue);

    runOnInstance(rtype.getClazz(), instance, "setProtectedField", 3);
View Full Code Here

   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
   
   
    B.loadNewVersion(B.bytesInitial);
   
    r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.