Search in sources :

Example 96 with TypeRegistry

use of org.springsource.loaded.TypeRegistry in project spring-loaded by spring-projects.

the class ReflectiveReflectionTests method testJLClassGetAnnotations.

@Test
public void testJLClassGetAnnotations() throws Exception {
    String t = "iri.JLCGetAnnotations";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1:@reflection.AnnoT()", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("1:@java.lang.Deprecated()", result.returnValue);
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) TypeRegistry(org.springsource.loaded.TypeRegistry) Test(org.junit.Test)

Example 97 with TypeRegistry

use of org.springsource.loaded.TypeRegistry in project spring-loaded by spring-projects.

the class ReflectiveReflectionTests method testJLClassGetDeclaredConstructor.

@Test
public void testJLClassGetDeclaredConstructor() throws Exception {
    String t = "iri.JLCGetDecConstructor";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("iri.JLCGetDecConstructor()", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("iri.JLCGetDecConstructor(String)", result.returnValue);
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) TypeRegistry(org.springsource.loaded.TypeRegistry) Test(org.junit.Test)

Example 98 with TypeRegistry

use of org.springsource.loaded.TypeRegistry in project spring-loaded by spring-projects.

the class ReflectiveReflectionTests method testJLRFIsAnnotationPresent.

@Test
public void testJLRFIsAnnotationPresent() throws Exception {
    String t = "iri.JLRFIsAnnotationPresent";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("truefalse", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("falsetrue", result.returnValue);
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) TypeRegistry(org.springsource.loaded.TypeRegistry) Test(org.junit.Test)

Example 99 with TypeRegistry

use of org.springsource.loaded.TypeRegistry in project spring-loaded by spring-projects.

the class ReflectiveReflectionTests method testJLRFGetTheRest.

// All the other gets!
@Test
public void testJLRFGetTheRest() throws Exception {
    String t = "iri.JLRFGetTheRest";
    TypeRegistry r = getTypeRegistry(t);
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    System.out.println(result);
    assertEquals("true 123 a 3.141 33.0 12345 444 99", result.returnValue);
    rtype.loadNewVersion(retrieveRenameRetarget(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("true 23 b 4.141 43.0 22345 544 999", result.returnValue);
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) TypeRegistry(org.springsource.loaded.TypeRegistry) Test(org.junit.Test)

Example 100 with TypeRegistry

use of org.springsource.loaded.TypeRegistry in project spring-loaded by spring-projects.

the class ReflectiveReflectionTests method testJLClassGetModifiers.

@Test
public void testJLClassGetModifiers() throws Exception {
    String t = "iri.JLCGetModifiers";
    TypeRegistry r = getTypeRegistry(t + ",iri.Helper");
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    ReloadableType rtypeh = r.addType("iri.Helper", loadBytesForClass("iri.Helper"));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("0", result.returnValue);
    rtypeh.loadNewVersion(rtypeh.bytesInitial);
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("0", result.returnValue);
}
Also used : ReloadableType(org.springsource.loaded.ReloadableType) TypeRegistry(org.springsource.loaded.TypeRegistry) Test(org.junit.Test)

Aggregations

TypeRegistry (org.springsource.loaded.TypeRegistry)322 Test (org.junit.Test)305 ReloadableType (org.springsource.loaded.ReloadableType)287 Result (org.springsource.loaded.test.infra.Result)97 TestClassloaderWithRewriting (org.springsource.loaded.test.infra.TestClassloaderWithRewriting)24 InvocationTargetException (java.lang.reflect.InvocationTargetException)20 TypeDescriptor (org.springsource.loaded.TypeDescriptor)20 Ignore (org.junit.Ignore)17 Method (java.lang.reflect.Method)13 TypeDescriptorExtractor (org.springsource.loaded.TypeDescriptorExtractor)13 MethodMember (org.springsource.loaded.MethodMember)10 IOException (java.io.IOException)5 Properties (java.util.Properties)5 ResultException (org.springsource.loaded.test.infra.ResultException)5 IncrementalTypeDescriptor (org.springsource.loaded.IncrementalTypeDescriptor)4 LoadtimeInstrumentationPlugin (org.springsource.loaded.LoadtimeInstrumentationPlugin)4 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 ZipEntry (java.util.zip.ZipEntry)3 ZipFile (java.util.zip.ZipFile)3