Package org.springsource.loaded

Examples of org.springsource.loaded.TypeRegistry


   * visibility when compiled
   */
  @Test
  public void reloadProtectedVisInner() throws Exception {
    String tclass = "inners.Four";
    TypeRegistry typeRegistry = getTypeRegistry("inners..*");
    typeRegistry.addType("inners.Four$Inner", retrieveRename("inners.Four$Inner", "inners.Four2$Inner","inners.Four2:inners.Four"));
    ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));
    runUnguarded(rtype.getClazz(), "runner");

    rtype.loadNewVersion("2", retrieveRename(tclass, tclass + "2", "inners.Four2$Inner:inners.Four$Inner","inners.Four2:inners.Four"));
    runUnguarded(rtype.getClazz(), "runner");
  }
View Full Code Here


   * Check properties of the newly created executor.
   */
  @Test
  public void basicExternals() throws Exception {
    String t = "executor.TestOne";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "37");
    Class<?> clazz = rtype.getLatestExecutorClass();
    Assert.assertEquals(Utils.getExecutorName(t, "37"), clazz.getName());
    Assert.assertEquals(3, clazz.getDeclaredMethods().length);
    Assert.assertEquals(1, clazz.getDeclaredFields().length);
View Full Code Here

   * Check internal structure of the newly created executor.
   */
  @Test
  public void basicInternalsLocalVariables() throws Exception {
    String t = "executor.TestOne";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "37");
    checkLocalVariables(rtype.getLatestExecutorBytes(), "foo(Lexecutor/TestOne;Ljava/lang/String;)J",
        "thiz:Lexecutor/TestOne;", "s:Ljava/lang/String;");
  }
View Full Code Here

  @Test
  public void codeStructure() throws Exception {
    String tclass = "executor.TestOne";

    TypeRegistry typeRegistry = getTypeRegistry(tclass);

    ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));

    // Reload it (triggers creation of dispatcher/executor)
    rtype.loadNewVersion("2", rtype.bytesInitial);

    // @formatter:off
View Full Code Here

  }

  @Test
  public void secondVersion() throws Exception {
    String tclass = "executor.TestOne";
    TypeRegistry typeRegistry = getTypeRegistry(tclass);

    ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));

    rtype.loadNewVersion("2", retrieveRename(tclass, tclass + "2"));

    // testing executor is for second version and not first
View Full Code Here

   * Testing that type level annotations are copied to the executor (to answer later reflection questions).
   */
  @Test
  public void typeLevelAnnotations() {
    String t = "executor.A";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "2");
    Class<?> clazz = rtype.getLatestExecutorClass();
    Assert.assertEquals(Utils.getExecutorName(t, "2"), clazz.getName());
    Annotation[] annos = clazz.getAnnotations();
    Assert.assertNotNull(annos);
View Full Code Here

   * annotation.
   */
  @Test
  public void typeLevelAnnotations2() {
    String t = "executor.A";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    rtype.loadNewVersion("2", retrieveRename(t, t + "2"));
    Class<?> clazz = rtype.getLatestExecutorClass();
    Assert.assertEquals(Utils.getExecutorName(t, "2"), clazz.getName());
    Annotation[] annos = clazz.getAnnotations();
    Assert.assertNotNull(annos);
View Full Code Here

  }

  @Test
  public void methodLevelAnnotations() throws Exception {
    String t = "executor.B";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "37");
    checkAnnotations(rtype.bytesLoaded, "m()V", "@common.Marker()");
    checkAnnotations(rtype.bytesLoaded, "m2()V");
    checkAnnotations(rtype.getLatestExecutorBytes(), "m(Lexecutor/B;)V", "@common.Marker()");
    checkAnnotations(rtype.getLatestExecutorBytes(), "m2(Lexecutor/B;)V");
View Full Code Here

  }

  @Test
  public void methodLevelAnnotationsOnInterfaces() throws Exception {
    String t = "executor.I";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    reload(rtype, "37");
    checkAnnotations(rtype.bytesLoaded, "m()V", "@common.Marker()");
    checkAnnotations(rtype.bytesLoaded, "m2()V");
    checkAnnotations(rtype.getLatestExecutorBytes(), "m(Lexecutor/I;)V", "@common.Marker()");
    checkAnnotations(rtype.getLatestExecutorBytes(), "m2(Lexecutor/I;)V");
View Full Code Here

//  }

  @Test
  public void methodLevelAnnotationsOnInterfaces2() throws Exception {
    String t = "reflection.methodannotations.InterfaceTarget";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    checkAnnotations(rtype.bytesLoaded, "privMethod()V", "@reflection.AnnoT3(value=Foo)");
    reload(rtype, "37");
    checkAnnotations(rtype.getLatestExecutorBytes(), "privMethod(Lreflection/methodannotations/InterfaceTarget;)V",
        "@reflection.AnnoT3(value=Foo)");
    rtype.loadNewVersion("39", retrieveRename(t, t + "002"));
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.