Package org.springsource.loaded

Examples of org.springsource.loaded.TypeRegistry


    assertEquals("String1",(String)r.returnValue);
  }
 
  @Test
  public void invokeStaticReloading_gh4_2() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic..*");
    tr.addType("invokestatic.issue4.AA", loadBytesForClass("invokestatic.issue4.AA"));
    ReloadableType BB = tr.addType("invokestatic.issue4.BB", loadBytesForClass("invokestatic.issue4.BB"));
   
    Result r = runUnguarded(BB.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
   
    BB.loadNewVersion(BB.bytesInitial);
View Full Code Here


    assertEquals("String1",(String)r.returnValue);
  }
 
  @Test
  public void invokeStaticReloading_gh4_3() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic..*");
    ReloadableType AAA = tr.addType("invokestatic.issue4.AAA", loadBytesForClass("invokestatic.issue4.AAA"));
    ReloadableType BBB = tr.addType("invokestatic.issue4.BBB", loadBytesForClass("invokestatic.issue4.BBB"));
   
    Result r = runUnguarded(BBB.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
   
    AAA.loadNewVersion(AAA.bytesInitial);
View Full Code Here

    assertEquals("String1",(String)r.returnValue);
  }
 
  @Test
  public void invokeStaticReloading_gh4_4() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic..*");
    ReloadableType A = tr.addType("invokestatic.issue4.A", loadBytesForClass("invokestatic.issue4.A"));
    ReloadableType B = tr.addType("invokestatic.issue4.B", loadBytesForClass("invokestatic.issue4.B"));
   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);

    A.loadNewVersion(A.bytesInitial);
View Full Code Here

  }
 
  // The supertype is not reloadable,it is in a jar
  @Test
  public void invokeStaticReloading_gh4_5() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic.issue4..*");
    ReloadableType B = tr.addType("invokestatic.issue4.BBBB", loadBytesForClass("invokestatic.issue4.BBBB"));
   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("Hello",(String)r.returnValue);
   
    ReloadableType thesuper = B.getSuperRtype();
    assertNull(thesuper);
    thesuper = tr.getReloadableType("invokestatic/issue4/subpkg/AAAA");
    assertNull(thesuper);
 
    B.loadNewVersion(B.bytesInitial);

    r = runUnguarded(B.getClazz(), "getMessage");
View Full Code Here

  }
 
  // Basic write/read then reload then write/read again
  @Test
  public void serialization1() throws Exception {
    TypeRegistry tr = getTypeRegistry("remote..*");
    ReloadableType person = tr.addType("remote.Person", loadBytesForClass("remote.Person"));
   
    // When the Serialize class is run directly, we see: byteinfo:len=98:crc=c1047cf6
    // When run via this test, we see: byteinfo:len=98:crc=7e07276a
    // Tried running the Serialize code directly but with a clinit in the Person class: 2b4c0df4

    ReloadableType runner = tr.addType("remote.Serialize", loadBytesForClass("remote.Serialize"));
   
    Result r = null;
    r = runUnguarded(runner.getClazz(), "run");
    assertContains("check ok", r.stdout);

View Full Code Here

 

  // Unlike the first test, this one will reload the class in between serialize and deserialize
  @Test
  public void serialization2() throws Exception {
    TypeRegistry tr = getTypeRegistry("remote..*");
    ReloadableType person = tr.addType("remote.Person", loadBytesForClass("remote.Person"));
   
    // byteinfo:len=98:crc=7e07276a
    ReloadableType runner = tr.addType("remote.Serialize", loadBytesForClass("remote.Serialize"));
   
    Class<?> clazz = runner.getClazz();
    Object instance = clazz.newInstance();
   
    Result r = null;
View Full Code Here

  }
 
  // Variant of the second test but using serialVersionUID and adding methods to the class on reload
  @Test
  public void serialization3() throws Exception {
    TypeRegistry tr = getTypeRegistry("remote..*");
    ReloadableType person = tr.addType("remote.PersonB", loadBytesForClass("remote.PersonB"));
    ReloadableType runner = tr.addType("remote.SerializeB", loadBytesForClass("remote.SerializeB"));
   
    Class<?> clazz = runner.getClazz();
    Object instance = clazz.newInstance();
   
    Result r = null;
View Full Code Here

 
  // Deserialize something we serialized earlier
  // This test cannot work without the agent. The agent must intercept java.lang.ObjectStream and its use of reflection
  // There is a test that will work in the SpringLoadedTestsInSeparateJVM
  public void serialization4() throws Exception {
    TypeRegistry tr = getTypeRegistry("remote..*");
//    ReloadableType person =
    tr.addType("remote.Person", loadBytesForClass("remote.Person"));
   
    // When the Serialize class is run directly, we see: byteinfo:len=98:crc=c1047cf6
    // When run via this test, we see: byteinfo:len=98:crc=7e07276a
    ReloadableType runner = tr.addType("remote.Serialize", loadBytesForClass("remote.Serialize"));
    Class<?> clazz = runner.getClazz();
    Object instance = clazz.newInstance();   
    Result r = runOnInstance(clazz,instance,"checkPredeserializedData");
    assertStdoutContains("Person stored ok", r);
  }
View Full Code Here

  }

  // extra class in the middle: A in jar, subtype AB reloadable, subtype BBBBB reloadable
  @Test
  public void invokeStaticReloading_gh4_6() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic.issue4..*");
    tr.addType("invokestatic.issue4.AB", loadBytesForClass("invokestatic.issue4.AB"));
    ReloadableType B = tr.addType("invokestatic.issue4.BBBBB", loadBytesForClass("invokestatic.issue4.BBBBB"));
   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("Hello",(String)r.returnValue);
   
    ReloadableType thesuper = B.getSuperRtype();
    thesuper = tr.getReloadableType("invokestatic/issue4/subpkg/AAAA");
    assertNull(thesuper);
   
    B.loadNewVersion(B.bytesInitial);

    r = runUnguarded(B.getClazz(), "getMessage");
View Full Code Here

    assertEquals("Hello",(String)r.returnValue);
  }
 
  @Test
  public void verifyingAssociatedTypesInfo() throws Exception {
    TypeRegistry tr = getTypeRegistry("invokestatic..*");
    ReloadableType mid = tr.addType("invokestatic.issue4.AB", loadBytesForClass("invokestatic.issue4.AB"));
    ReloadableType B = tr.addType("invokestatic.issue4.BBBBB", loadBytesForClass("invokestatic.issue4.BBBBB"));
   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("Hello",(String)r.returnValue);
   
    ReloadableType thesuper = B.getSuperRtype();
    thesuper = tr.getReloadableType("invokestatic/issue4/subpkg/AAAA");
    assertNull(thesuper);
   
    B.loadNewVersion(B.bytesInitial);

    r = runUnguarded(B.getClazz(), "getMessage");
View Full Code Here

TOP

Related Classes of org.springsource.loaded.TypeRegistry

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.