Package org.springsource.loaded

Examples of org.springsource.loaded.TypeRegistry$BsmInfo


    Assert.assertEquals("0x1 foo()V", typeDescriptor.getMethods()[0].toString());
  }

  @Test
  public void nonReloadableExtract() {
    TypeRegistry tr = getTypeRegistry("");
    byte[] bytes = loadBytesForClass("java.lang.Object");
    TypeDescriptor typeDescriptor = new TypeDescriptorExtractor(tr).extract(bytes, false);
    System.out.println(typeDescriptor.toString());
    Assert.assertEquals("java/lang/Object", typeDescriptor.getName());
    Assert.assertEquals(null, typeDescriptor.getSupertypeName());
View Full Code Here


  @Test
  public void fields() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String a = "simple.Front";
    String b = "simple.Back";
    TypeRegistry r = getTypeRegistry(a + "," + b);
    ReloadableType rtypea = r.addType(a, loadBytesForClass(a));
    ReloadableType rtypeb = r.addType(b, loadBytesForClass(b));
    result = runUnguarded(rtypea.getClazz(), "run");
    assertEquals(35, result.returnValue);

    try {
      result = runUnguarded(rtypea.getClazz(), "run2");
View Full Code Here

  @Ignore
  @Test
  public void reflection() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String a = "simple.SelfReflector";
    TypeRegistry r = getTypeRegistry(a);
    ReloadableType rtypea = r.addType(a, loadBytesForClass(a));
    result = runUnguarded(rtypea.getClazz(), "run");

    assertEquals(
        "14 $callSiteArray $class$java$lang$String $class$java$lang$StringBuilder $class$java$lang$reflect$Field $class$java$util$ArrayList $class$java$util$Collections $class$java$util$Iterator $class$java$util$List $class$simple$SelfReflector $staticClassInfo __$stMC array$$class$java$lang$reflect$Field i metaClass",
        result.returnValue);
View Full Code Here

  // field constants?
  @Test
  public void localVariables() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String a = "simple.LFront";
    TypeRegistry r = getTypeRegistry(a);
    ReloadableType rtypea = r.addType(a, loadBytesForClass(a));
    result = runUnguarded(rtypea.getClazz(), "run");
    assertEquals("abc", result.returnValue);
    result = runUnguarded(rtypea.getClazz(), "run2");
    assertEquals(99, result.returnValue);
View Full Code Here

  @Test
  public void fieldsOnInstance() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String a = "simple.Front";
    String b = "simple.Back";
    TypeRegistry r = getTypeRegistry(a + "," + b);
    ReloadableType rtypea = r.addType(a, loadBytesForClass(a));
    ReloadableType rtypeb = r.addType(b, loadBytesForClass(b));
    Object instance = rtypea.getClazz().newInstance();
    result = runOnInstance(rtypea.getClazz(), instance, "run");
    assertEquals(35, result.returnValue);
    try {
      result = runOnInstance(rtypea.getClazz(), instance, "run2");
View Full Code Here

  // Changing the return value within a method
  @Test
  public void basic() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String t = "simple.Basic";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("hello", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("goodbye", result.returnValue);
View Full Code Here

  @Test
  public void basicInstance() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String t = "simple.Basic";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    Object instance = null;
    instance = rtype.getClazz().newInstance();

    // First method call to 'run' should return "hello"
    result = runOnInstance(rtype.getClazz(), instance, "run");
View Full Code Here

  // one (simply checking the callsite cache is reset)
  @Test
  public void basic2() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String t = "simple.BasicB";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("hello", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("goodbye", result.returnValue);
View Full Code Here

  // Similar to BasicB but now using non-static methods
  @Test
  public void basic3() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String t = "simple.BasicC";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("hello", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("goodbye", result.returnValue);
View Full Code Here

  @Test
  public void basic4() throws Exception {
    binLoader = new TestClassloaderWithRewriting();
    String t = "simple.BasicD";
    String target = "simple.BasicDTarget";
    TypeRegistry r = getTypeRegistry(t + "," + target);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    ReloadableType rtypeTarget = r.addType(target, loadBytesForClass(target));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("hello", result.returnValue);
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    rtypeTarget.loadNewVersion("2", retrieveRename(target, target + "2"));
    result = runUnguarded(rtype.getClazz(), "run");
View Full Code Here

TOP

Related Classes of org.springsource.loaded.TypeRegistry$BsmInfo

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.