Package org.springsource.loaded

Examples of org.springsource.loaded.TypeRegistry


  }

  @Test
  public void clashingInstanceStaticMethods() throws Exception {
    String t = "executor.C";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "37");
  }
View Full Code Here


  }

  @Test
  public void staticInitializerReloading1() 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"));
    rtype.runStaticInitializer(); // call is made on reloadable type
    result = runUnguarded(rtype.getClazz(), "run");
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
View Full Code Here

   * Dealing with final fields
   */
  @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");
View Full Code Here

   * Type that doesn't really have a clinit
   */
  @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");
View Full Code Here

   *
   * @return new TypeRegistry
   */
  protected TypeRegistry getTypeRegistry(String includePatterns) {
    TypeRegistry.reinitialize();
    TypeRegistry tr = TypeRegistry.getTypeRegistryFor(binLoader);
    Properties p = new Properties();
    if (includePatterns != null) {
      p.setProperty(TypeRegistry.Key_Inclusions, includePatterns);
    }
    if (tr == null) {
      throw new IllegalStateException(
          "maybe you need to run with: -Dspringloaded=limit=false -Xmx512M -XX:MaxPermSize=256m -noverify");
    }
    tr.configure(p);
    return tr;
  }
View Full Code Here

*/
public class TypeRegistryTests extends SpringLoadedTests {

  @Test
  public void basics() {
    TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(binLoader);
    assertNotNull(typeRegistry);
    typeRegistry = TypeRegistry.getTypeRegistryFor(null);
    assertNull(typeRegistry);
  }
View Full Code Here

  /**
   * Same instance for two different calls passing the same classloader.
   */
  @Test
  public void sameInstance() {
    TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(binLoader);
    assertNotNull(typeRegistry);
    TypeRegistry typeRegistry2 = TypeRegistry.getTypeRegistryFor(binLoader);
    assertNotNull(typeRegistry2);
    assertTrue(typeRegistry == typeRegistry2);
  }
View Full Code Here

    assertTrue(typeRegistry == typeRegistry2);
  }

  @Test
  public void loadingDescriptors() {
    TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(binLoader);
    TypeDescriptor jloDescriptor = typeRegistry.getDescriptorFor("java/lang/Object");
    assertNotNull(jloDescriptor);
    assertEquals("java/lang/Object", jloDescriptor.getName());
  }
View Full Code Here

    assertEquals("java/lang/Object", jloDescriptor.getName());
  }

  @Test
  public void descriptorsWithCatchers() {
    TypeRegistry typeRegistry = TypeRegistry.getTypeRegistryFor(binLoader);
    TypeDescriptor dscDescriptor = typeRegistry.getDescriptorFor("data/SimpleClass");
    assertNotNull(dscDescriptor);
    assertEquals("data/SimpleClass", dscDescriptor.getName());
    // check for a catcher
    assertNotNull(findMethod("0x1 toString()Ljava/lang/String;", dscDescriptor));
  }
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.