Package org.springsource.loaded

Examples of org.springsource.loaded.TypeRegistry.addType()


  @Test
  public void staticInitializers() throws Exception {
    String t = "test.Initializers";
    String t2 = "test.SubInitializers";
    TypeRegistry r = getTypeRegistry(t + "," + t2);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    ReloadableType subtype = r.addType(t2, loadBytesForClass(t2));

    // Check the format of the modified static initializer
    // @formatter:off
    assertEquals(
View Full Code Here


  public void staticInitializers() throws Exception {
    String t = "test.Initializers";
    String t2 = "test.SubInitializers";
    TypeRegistry r = getTypeRegistry(t + "," + t2);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    ReloadableType subtype = r.addType(t2, loadBytesForClass(t2));

    // Check the format of the modified static initializer
    // @formatter:off
    assertEquals(
      // initialization of reloadabletype
View Full Code Here

  @Test
  public void staticInitializersAndInterfaces() throws Exception {
    String t = "test.Interface";
    String t2 = "test.SubInterface";
    TypeRegistry r = getTypeRegistry(t + "," + t2);
    ReloadableType itype = r.addType(t, loadBytesForClass(t));
    ReloadableType subitype = r.addType(t2, loadBytesForClass(t2));

//    ClassPrinter.print(subitype.bytesLoaded);

    // An interface will get the reloadable type field
View Full Code Here

  public void staticInitializersAndInterfaces() throws Exception {
    String t = "test.Interface";
    String t2 = "test.SubInterface";
    TypeRegistry r = getTypeRegistry(t + "," + t2);
    ReloadableType itype = r.addType(t, loadBytesForClass(t));
    ReloadableType subitype = r.addType(t2, loadBytesForClass(t2));

//    ClassPrinter.print(subitype.bytesLoaded);

    // An interface will get the reloadable type field
    assertEquals("0x19(public static final) r$type Lorg/springsource/loaded/ReloadableType;",
View Full Code Here

  // Looking at a type with only a default ctor (so didn't originally declare anything)
  @Test
  public void constructorReloadingDefault() throws Exception {
    String t = "ctors.Default";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    MethodMember[] ctor = rtype.getLatestTypeDescriptor().getConstructors();
    assertEquals(1, ctor.length); // Only the ctor in the original type is in the descriptor
    assertEquals("0x1 <init>()V", ctor[0].toString());
    // There are in fact two constructors, one is our special one
    result = runConstructor(rtype.getClazz(), magicDescriptorForGeneratedCtors, new Object[] { null });
View Full Code Here

  // Tests for reloading the body of an existing constructor
  @Test
  public void constructorReloading() throws Exception {
    String t = "ctors.One";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));

    result = runConstructor(rtype.getClazz(), "");
    assertEquals("Hello Andy", result.stdout);
    assertEquals(rtype.getClazz().getName(), result.returnValue.getClass().getName());
View Full Code Here

  // similar to previous but constructor takes a parameter
  @Test
  public void constructorReloading2() throws Exception {
    String t = "ctors.Two";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));

    result = runConstructor(rtype.getClazz(), "java.lang.String", "Wibble");
    assertEquals("Wibble", result.stdout);
    assertEquals(rtype.getClazz().getName(), result.returnValue.getClass().getName());
View Full Code Here

  @Test
  public void annotation() throws Exception {
    String a = "annos.SimpleAnnotation";
    String b = "annos.AnnotatedType";
    TypeRegistry r = getTypeRegistry(a + "," + b);
    ReloadableType annotationType = r.addType(a, loadBytesForClass(a));
    ReloadableType annotatedType = r.addType(b, loadBytesForClass(b));

    assertNull(annotationType);
    result = runUnguarded(annotatedType.getClazz(), "printit");
    assertEquals("@annos.SimpleAnnotation(value=hello)", result.stdout);
View Full Code Here

  public void annotation() throws Exception {
    String a = "annos.SimpleAnnotation";
    String b = "annos.AnnotatedType";
    TypeRegistry r = getTypeRegistry(a + "," + b);
    ReloadableType annotationType = r.addType(a, loadBytesForClass(a));
    ReloadableType annotatedType = r.addType(b, loadBytesForClass(b));

    assertNull(annotationType);
    result = runUnguarded(annotatedType.getClazz(), "printit");
    assertEquals("@annos.SimpleAnnotation(value=hello)", result.stdout);
View Full Code Here

   */
  @Test
  public void reflectiveFieldGet() throws Exception {
    String a = "reflect.FieldAccessing";
    TypeRegistry r = getTypeRegistry(a);
    ReloadableType type = r.addType(a, loadBytesForClass(a));

    Object o = type.getClazz().newInstance();

    // Access the fields
    result = runOnInstance(type.getClazz(), o, "geti");
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.