Package org.springsource.loaded

Examples of org.springsource.loaded.ReloadableType


  @Test
  public void testJLRMIsAnnotationPresent() throws Exception {
    String t = "iri.JLRMIsAnnotationPresent";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("truefalse", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("falsetrue", result.returnValue);
  }
View Full Code Here


  @Test
  public void testJLRMGetParameterAnnotations() throws Exception {
    String t = "iri.JLRMGetParameterAnnotations";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("[1:@reflection.AnnoT()][0:][1:@reflection.AnnoT2()]", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("[1:@reflection.AnnoT2()][1:@reflection.AnnoT()][0:]", result.returnValue);
  }
View Full Code Here

  @Test
  public void testJLRMInvoke() throws Exception {
    String t = "iri.JLRMInvoke";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("ran", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("alsoran", result.returnValue);
    rtype.loadNewVersion("3", retrieveRename(t, t + "3", t + "3:" + t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("abc3", result.returnValue);
  }
View Full Code Here

  @Test
  public void testJLRFGetAnnotation() throws Exception {
    String t = "iri.JLRFGetAnnotation";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("@reflection.AnnoT() null", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("null @java.lang.Deprecated()", result.returnValue);
  }
View Full Code Here

  @Test
  public void testJLRFIsAnnotationPresent() throws Exception {
    String t = "iri.JLRFIsAnnotationPresent";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("truefalse", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("falsetrue", result.returnValue);
  }
View Full Code Here

  @Test
  public void testJLRFGetAnnotations() throws Exception {
    String t = "iri.JLRFGetAnnotations";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1:@reflection.AnnoT()", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1:@java.lang.Deprecated()", result.returnValue);
  }
View Full Code Here

  @Test
  public void staticInitializerReloading2() throws Exception {
    String t = "clinit.One";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("5", result.returnValue);
    rtype.loadNewVersion("39", retrieveRename(t, t + "2"));

    // use the 'new' ___clinit___ method to drive the static initializer
    Method staticInitializer = rtype.getClazz().getMethod("___clinit___");
    assertNotNull(staticInitializer);
    staticInitializer.invoke(null);

    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("7", result.returnValue);
  }
View Full Code Here

   */
  @Test
  public void staticInitializerReloading3() throws Exception {
    String t = "clinit.Two";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("55", result.returnValue);
    rtype.loadNewVersion("39", retrieveRename(t, t + "2"));
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("99", result.returnValue);
  }
View Full Code Here

   */
  @Test
  public void staticInitializerReloading4() throws Exception {
    String t = "clinit.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"));
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
    ClassPrinter.print(rtype.getLatestExecutorBytes());
    assertEquals("4", result.returnValue);
  }
View Full Code Here

  /**
   * Check the basics - does the SubLoader/SuperLoader mechanism work.
   */
  @Test
  public void loadTypesAcrossLoaders() throws Exception {
    ReloadableType rtypeA = subLoader.loadAsReloadableType("superpkg.Top");
    result = runUnguarded(rtypeA.getClazz(), "m");
    assertEquals("Top.m() running", result.stdout);

    ReloadableType rtypeB = subLoader.loadAsReloadableType("subpkg.Bottom");
    result = runUnguarded(rtypeB.getClazz(), "m");
    assertEquals("Bottom.m() running", result.stdout);
    assertNotSame(rtypeA.getTypeRegistry(), rtypeB.getTypeRegistry());
  }
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.