use of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails in project spring-roo by spring-projects.
the class NewUpdateCompilationUnitTest method testSimpleInterfaceVoidFile.
@Test
public void testSimpleInterfaceVoidFile() throws Exception {
// Set up
final File file = getResource(SIMPLE_INTERFACE_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService.getTypeFromString(fileContents, SIMPLE_INTERFACE_DECLARED_BY_MID, SIMPLE_INTERFACE_TYPE);
final File voidFile = new File(file.getCanonicalFile() + ".void");
// Invoke
final String result = typeParsingService.updateAndGetCompilationUnitContents(voidFile.getCanonicalPath(), simpleInterfaceDetails);
saveResult(file, result, "-void");
checkSimpleInterface(result, false);
}
use of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails in project spring-roo by spring-projects.
the class NewUpdateCompilationUnitTest method testSimpleClassAddAnnotation.
@Test
public void testSimpleClassAddAnnotation() throws Exception {
// Set up
final File file = getResource(SIMPLE_CLASS_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService.getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID, SIMPLE_CLASS_TYPE);
final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(new JavaType("org.springframework.roo.addon.javabean.addon.RooToString"));
final ClassOrInterfaceTypeDetails newSimpleInterfaceDetails = addAnnotation(simpleInterfaceDetails, annotationBuilder.build());
// Invoke
final String result = typeParsingService.updateAndGetCompilationUnitContents(file.getCanonicalPath(), newSimpleInterfaceDetails);
saveResult(file, result, "-addedAnnotation");
checkSimpleClass(result);
assertTrue(result.contains("import org.springframework.roo.addon.javabean.addon.RooToString;"));
assertTrue(result.contains("@RooToString"));
// Invoke again
final ClassOrInterfaceTypeDetails simpleInterfaceDetails2 = typeParsingService.getTypeFromString(result, SIMPLE_CLASS_DECLARED_BY_MID, SIMPLE_CLASS_TYPE);
final String result2 = typeParsingService.updateAndGetCompilationUnitContents(file.getCanonicalPath(), simpleInterfaceDetails2);
saveResult(file, result2, "-addedAnnotation2");
checkSimpleClass(result2);
assertTrue(result2.contains("import org.springframework.roo.addon.javabean.addon.RooToString;"));
assertTrue(result2.contains("@RooToString"));
}
use of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails in project spring-roo by spring-projects.
the class NewUpdateCompilationUnitTest method testSimpleClass3NoChanges.
@Test
public void testSimpleClass3NoChanges() throws Exception {
// Set up
final File file = getResource(SIMPLE_CLASS3_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService.getTypeFromString(fileContents, SIMPLE_CLASS3_DECLARED_BY_MID, SIMPLE_CLASS3_TYPE);
// Invoke
final String result = typeParsingService.updateAndGetCompilationUnitContents(file.getAbsolutePath(), simpleInterfaceDetails);
saveResult(file, result);
checkSimple3Class(result);
}
use of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails in project spring-roo by spring-projects.
the class NewUpdateCompilationUnitTest method testSimpleClassNoChanges.
@Test
public void testSimpleClassNoChanges() throws Exception {
// Set up
final File file = getResource(SIMPLE_CLASS_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService.getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID, SIMPLE_CLASS_TYPE);
// Invoke
final String result = typeParsingService.updateAndGetCompilationUnitContents(file.getCanonicalPath(), simpleInterfaceDetails);
saveResult(file, result);
checkSimpleClass(result);
}
use of org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails in project spring-roo by spring-projects.
the class NewUpdateCompilationUnitTest method testSimpleClass2NoChanges.
@Test
public void testSimpleClass2NoChanges() throws Exception {
// Set up
final File file = getResource(SIMPLE_CLASS2_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService.getTypeFromString(fileContents, SIMPLE_CLASS2_DECLARED_BY_MID, SIMPLE_CLASS2_TYPE);
// Invoke
final String result = typeParsingService.updateAndGetCompilationUnitContents(file.getAbsolutePath(), simpleInterfaceDetails);
saveResult(file, result);
checkSimple2Class(result);
}
Aggregations