Search in sources :

Example 46 with JavaClassSource

use of org.jboss.forge.roaster.model.source.JavaClassSource in project EhViewer by seven332.

the class EhDaoGenerator method adjustHistoryInfo.

private static void adjustHistoryInfo() throws Exception {
    JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, new File(HISTORY_INFO_PATH));
    // Remove field from GalleryInfo
    javaClass.removeField(javaClass.getField("gid"));
    javaClass.removeField(javaClass.getField("token"));
    javaClass.removeField(javaClass.getField("title"));
    javaClass.removeField(javaClass.getField("titleJpn"));
    javaClass.removeField(javaClass.getField("thumb"));
    javaClass.removeField(javaClass.getField("category"));
    javaClass.removeField(javaClass.getField("posted"));
    javaClass.removeField(javaClass.getField("uploader"));
    javaClass.removeField(javaClass.getField("rating"));
    javaClass.removeField(javaClass.getField("simpleLanguage"));
    // Set all field public
    javaClass.getField("mode").setPublic();
    javaClass.getField("time").setPublic();
    // Add Parcelable stuff
    javaClass.addMethod("\t@Override\n" + "\tpublic int describeContents() {\n" + "\t\treturn 0;\n" + "\t}");
    javaClass.addMethod("\t@Override\n" + "\tpublic void writeToParcel(Parcel dest, int flags) {\n" + "\t\tsuper.writeToParcel(dest, flags);\n" + "\t\tdest.writeInt(this.mode);\n" + "\t\tdest.writeLong(this.time);\n" + "\t}");
    javaClass.addMethod("\tprotected HistoryInfo(Parcel in) {\n" + "\t\tsuper(in);\n" + "\t\tthis.mode = in.readInt();\n" + "\t\tthis.time = in.readLong();\n" + "\t}").setConstructor(true);
    javaClass.addField("\tpublic static final Creator<HistoryInfo> CREATOR = new Creator<HistoryInfo>() {\n" + "\t\t@Override\n" + "\t\tpublic HistoryInfo createFromParcel(Parcel source) {\n" + "\t\t\treturn new HistoryInfo(source);\n" + "\t\t}\n" + "\n" + "\t\t@Override\n" + "\t\tpublic HistoryInfo[] newArray(int size) {\n" + "\t\t\treturn new HistoryInfo[size];\n" + "\t\t}\n" + "\t};");
    javaClass.addImport("android.os.Parcel");
    // Add from GalleryInfo constructor
    javaClass.addMethod("\tpublic HistoryInfo(GalleryInfo galleryInfo) {\n" + "\t\tthis.gid = galleryInfo.gid;\n" + "\t\tthis.token = galleryInfo.token;\n" + "\t\tthis.title = galleryInfo.title;\n" + "\t\tthis.titleJpn = galleryInfo.titleJpn;\n" + "\t\tthis.thumb = galleryInfo.thumb;\n" + "\t\tthis.category = galleryInfo.category;\n" + "\t\tthis.posted = galleryInfo.posted;\n" + "\t\tthis.uploader = galleryInfo.uploader;\n" + "\t\tthis.rating = galleryInfo.rating;\n" + "\t\tthis.simpleTags = galleryInfo.simpleTags;\n" + "\t\tthis.simpleLanguage = galleryInfo.simpleLanguage;\n" + "\t}").setConstructor(true);
    javaClass.addImport("com.hippo.ehviewer.client.data.GalleryInfo");
    FileWriter fileWriter = new FileWriter(HISTORY_INFO_PATH);
    fileWriter.write(javaClass.toString());
    fileWriter.close();
}
Also used : FileWriter(java.io.FileWriter) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) File(java.io.File)

Example 47 with JavaClassSource

use of org.jboss.forge.roaster.model.source.JavaClassSource in project EhViewer by seven332.

the class EhDaoGenerator method adjustQuickSearch.

private static void adjustQuickSearch() throws Exception {
    JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, new File(QUICK_SEARCH_PATH));
    // Set all field public
    javaClass.getField("id").setPublic();
    javaClass.getField("name").setPublic();
    javaClass.getField("mode").setPublic();
    javaClass.getField("category").setPublic();
    javaClass.getField("keyword").setPublic();
    javaClass.getField("advanceSearch").setPublic();
    javaClass.getField("minRating").setPublic();
    javaClass.getField("pageFrom").setPublic();
    javaClass.getField("pageTo").setPublic();
    javaClass.getField("time").setPublic();
    javaClass.addMethod("\t@Override\n" + "\tpublic String toString() {\n" + "\t\treturn name;\n" + "\t}");
    FileWriter fileWriter = new FileWriter(QUICK_SEARCH_PATH);
    fileWriter.write(javaClass.toString());
    fileWriter.close();
}
Also used : FileWriter(java.io.FileWriter) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) File(java.io.File)

Example 48 with JavaClassSource

use of org.jboss.forge.roaster.model.source.JavaClassSource in project EhViewer by seven332.

the class EhDaoGenerator method adjustBookmarkInfo.

private static void adjustBookmarkInfo() throws Exception {
    JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, new File(BOOKMARK_INFO_PATH));
    // Remove field from GalleryInfo
    javaClass.removeField(javaClass.getField("gid"));
    javaClass.removeField(javaClass.getField("token"));
    javaClass.removeField(javaClass.getField("title"));
    javaClass.removeField(javaClass.getField("titleJpn"));
    javaClass.removeField(javaClass.getField("thumb"));
    javaClass.removeField(javaClass.getField("category"));
    javaClass.removeField(javaClass.getField("posted"));
    javaClass.removeField(javaClass.getField("uploader"));
    javaClass.removeField(javaClass.getField("rating"));
    javaClass.removeField(javaClass.getField("simpleLanguage"));
    // Set all field public
    javaClass.getField("page").setPublic();
    javaClass.getField("time").setPublic();
    // Add Parcelable stuff
    javaClass.addMethod("\t@Override\n" + "\tpublic int describeContents() {\n" + "\t\treturn 0;\n" + "\t}");
    javaClass.addMethod("\t@Override\n" + "\tpublic void writeToParcel(Parcel dest, int flags) {\n" + "\t\tsuper.writeToParcel(dest, flags);\n" + "\t\tdest.writeInt(this.page);\n" + "\t\tdest.writeLong(this.time);\n" + "\t}");
    javaClass.addMethod("\tprotected BookmarkInfo(Parcel in) {\n" + "\t\tsuper(in);\n" + "\t\tthis.page = in.readInt();\n" + "\t\tthis.time = in.readLong();\n" + "\t}").setConstructor(true);
    javaClass.addField("\tpublic static final Creator<BookmarkInfo> CREATOR = new Creator<BookmarkInfo>() {\n" + "\t\t@Override\n" + "\t\tpublic BookmarkInfo createFromParcel(Parcel source) {\n" + "\t\t\treturn new BookmarkInfo(source);\n" + "\t\t}\n" + "\n" + "\t\t@Override\n" + "\t\tpublic BookmarkInfo[] newArray(int size) {\n" + "\t\t\treturn new BookmarkInfo[size];\n" + "\t\t}\n" + "\t};");
    javaClass.addImport("android.os.Parcel");
    // Add from GalleryInfo constructor
    javaClass.addMethod("\tpublic BookmarkInfo(GalleryInfo galleryInfo) {\n" + "\t\tthis.gid = galleryInfo.gid;\n" + "\t\tthis.token = galleryInfo.token;\n" + "\t\tthis.title = galleryInfo.title;\n" + "\t\tthis.titleJpn = galleryInfo.titleJpn;\n" + "\t\tthis.thumb = galleryInfo.thumb;\n" + "\t\tthis.category = galleryInfo.category;\n" + "\t\tthis.posted = galleryInfo.posted;\n" + "\t\tthis.uploader = galleryInfo.uploader;\n" + "\t\tthis.rating = galleryInfo.rating;\n" + "\t\tthis.simpleTags = galleryInfo.simpleTags;\n" + "\t\tthis.simpleLanguage = galleryInfo.simpleLanguage;\n" + "\t}").setConstructor(true);
    javaClass.addImport("com.hippo.ehviewer.client.data.GalleryInfo");
    FileWriter fileWriter = new FileWriter(BOOKMARK_INFO_PATH);
    fileWriter.write(javaClass.toString());
    fileWriter.close();
}
Also used : FileWriter(java.io.FileWriter) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) File(java.io.File)

Example 49 with JavaClassSource

use of org.jboss.forge.roaster.model.source.JavaClassSource in project kie-wb-common by kiegroup.

the class JavaRoasterModelDriverTest method importsUpdateTest.

@Test
public void importsUpdateTest() throws Exception {
    Path importsUpdateTestFilePath = rootPath.resolve("package6").resolve("ImportsUpdateTest.java");
    String source = ioService.readAllString(importsUpdateTestFilePath);
    JavaClassSource importsUpdateTestJavaClassSource = (JavaClassSource) Roaster.parse(source);
    ClassLoader classLoader = getClass().getClassLoader();
    ClassTypeResolver classTypeResolver = DriverUtils.createClassTypeResolver(importsUpdateTestJavaClassSource, classLoader);
    final SourceFilter pojo1Filter = javaType -> false;
    final NestedClassFilter nestedClassFilter = javaType -> javaType.isClass() && javaType.getAnnotation(Generated.class) != null;
    final MethodFilter methodFilter = method -> !method.isConstructor() && method.getAnnotation(Generated.class) != null;
    FilterHolder filterHolder = mock(FilterHolder.class);
    when(filterHolder.getSourceFilters()).thenReturn(Collections.singleton(pojo1Filter));
    when(filterHolder.getNestedClassFilters()).thenReturn(Collections.singleton(nestedClassFilter));
    when(filterHolder.getMethodFilters()).thenReturn(Collections.singleton(methodFilter));
    JavaRoasterModelDriver javaRoasterModelDriver = new JavaRoasterModelDriver(ioService, rootPath, classLoader, filterHolder);
    ModelDriverResult result = javaRoasterModelDriver.loadDataObject(source, importsUpdateTestFilePath);
    DataObject importsUpdateTest = result.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTest");
    importsUpdateTest.addImport(new ImportImpl(List.class.getName()));
    importsUpdateTest.addImport(new ImportImpl(ArrayList.class.getName()));
    importsUpdateTest.setName("ImportsUpdateTestResult");
    Path expectedFilePath = rootPath.resolve("package6").resolve("ImportsUpdateTestResult.java");
    String expectedSource = ioService.readAllString(expectedFilePath);
    ModelDriverResult expectedResult = javaRoasterModelDriver.loadDataObject(expectedSource, expectedFilePath);
    DataObject importsUpdateTestResult = expectedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult");
    DataModelerAssert.assertEqualsDataObject(importsUpdateTestResult, importsUpdateTest);
    DataModelerAssert.assertEqualsImports(importsUpdateTestResult.getImports(), importsUpdateTest.getImports());
    javaRoasterModelDriver.updateSource(importsUpdateTestJavaClassSource, importsUpdateTest, new UpdateInfo(), classTypeResolver);
    ModelDriverResult updatedResult = javaRoasterModelDriver.loadDataObject(importsUpdateTestJavaClassSource.toString(), importsUpdateTestFilePath);
    DataModelerAssert.assertEqualsDataObject(importsUpdateTestResult, updatedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult"));
    DataModelerAssert.assertEqualsImports(importsUpdateTestResult.getImports(), updatedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult").getImports());
}
Also used : Path(org.uberfire.java.nio.file.Path) Description(org.kie.api.definition.type.Description) Arrays(java.util.Arrays) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) Timestamp(org.kie.api.definition.type.Timestamp) Label(org.kie.api.definition.type.Label) TestAnnotation1(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation1) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) LoggerFactory(org.slf4j.LoggerFactory) DataModelerAssert(org.kie.workbench.common.services.datamodeller.DataModelerAssert) Paths(org.uberfire.backend.server.util.Paths) Generated(javax.annotation.Generated) Matcher(java.util.regex.Matcher) Roaster(org.jboss.forge.roaster.Roaster) ClassAnnotation(org.kie.workbench.common.services.datamodeller.annotations.ClassAnnotation) SequenceGenerator(javax.persistence.SequenceGenerator) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) JavaEnum(org.kie.workbench.common.services.datamodeller.core.JavaEnum) URI(java.net.URI) Instance(javax.enterprise.inject.Instance) Entity(javax.persistence.Entity) ParameterImpl(org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl) UniqueConstraint(javax.persistence.UniqueConstraint) ClassReactive(org.kie.api.definition.type.ClassReactive) JavaTypeInfo(org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo) ENUM3(org.kie.workbench.common.services.datamodeller.annotations.ENUM3) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) List(java.util.List) AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) DataModelImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataModelImpl) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) EnumsAnnotation(org.kie.workbench.common.services.datamodeller.annotations.EnumsAnnotation) AnnotationValuesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.AnnotationValuesAnnotation) Role(org.kie.api.definition.type.Role) JavaClassImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaClassImpl) PrimitivesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.PrimitivesAnnotation) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Expires(org.kie.api.definition.type.Expires) TestAnnotation(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation) MarkerAnnotation(org.kie.workbench.common.services.datamodeller.annotations.MarkerAnnotation) Parameter(org.kie.workbench.common.services.datamodeller.core.Parameter) Mock(org.mockito.Mock) Path(org.uberfire.java.nio.file.Path) RunWith(org.junit.runner.RunWith) DriverUtils(org.kie.workbench.common.services.datamodeller.util.DriverUtils) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) Type(org.kie.workbench.common.services.datamodeller.core.Type) ArrayList(java.util.ArrayList) Table(javax.persistence.Table) TypeSafe(org.kie.api.definition.type.TypeSafe) Duration(org.kie.api.definition.type.Duration) DataModel(org.kie.workbench.common.services.datamodeller.core.DataModel) Before(org.junit.Before) Logger(org.slf4j.Logger) JavaEnumImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaEnumImpl) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) IOException(java.io.IOException) Test(org.junit.Test) Method(org.kie.workbench.common.services.datamodeller.core.Method) InputStreamReader(java.io.InputStreamReader) File(java.io.File) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) DataObjectImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataObjectImpl) MethodImpl(org.kie.workbench.common.services.datamodeller.core.impl.MethodImpl) Mockito(org.mockito.Mockito) TestEnums(org.kie.workbench.common.services.datamodeller.annotations.TestEnums) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Position(org.kie.api.definition.type.Position) JavaClass(org.kie.workbench.common.services.datamodeller.core.JavaClass) TypeImpl(org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) IOService(org.uberfire.io.IOService) BufferedReader(java.io.BufferedReader) Key(org.kie.api.definition.type.Key) Assert(org.junit.Assert) Collections(java.util.Collections) Visibility(org.kie.workbench.common.services.datamodeller.core.Visibility) InputStream(java.io.InputStream) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) Test(org.junit.Test)

Example 50 with JavaClassSource

use of org.jboss.forge.roaster.model.source.JavaClassSource in project kie-wb-common by kiegroup.

the class JavaRoasterModelDriverTest method methodUpdateTest.

@Test
public void methodUpdateTest() {
    try {
        // First read the MethodsUpdateTest
        Path methodsUpdateTestFilePath = rootPath.resolve("package4").resolve("MethodsUpdateTest.java");
        String source = ioService.readAllString(methodsUpdateTestFilePath);
        JavaClassSource methodsUpdateTestJavaClassSource = (JavaClassSource) Roaster.parse(source);
        ClassLoader classLoader = getClass().getClassLoader();
        ClassTypeResolver classTypeResolver = DriverUtils.createClassTypeResolver(methodsUpdateTestJavaClassSource, classLoader);
        final SourceFilter pojo1Filter = javaType -> false;
        final NestedClassFilter nestedClassFilter = javaType -> javaType.isClass() && javaType.getAnnotation(Generated.class) != null;
        final MethodFilter methodFilter = method -> !method.isConstructor() && method.getAnnotation(Generated.class) != null;
        FilterHolder filterHolder = mock(FilterHolder.class);
        when(filterHolder.getSourceFilters()).thenReturn(Collections.singleton(pojo1Filter));
        when(filterHolder.getNestedClassFilters()).thenReturn(Collections.singleton(nestedClassFilter));
        when(filterHolder.getMethodFilters()).thenReturn(Collections.singleton(methodFilter));
        JavaRoasterModelDriver javaRoasterModelDriver = new JavaRoasterModelDriver(ioService, rootPath, classLoader, filterHolder);
        ModelDriverResult result = javaRoasterModelDriver.loadDataObject(source, methodsUpdateTestFilePath);
        // 1) read the MethodsUpdateTest
        DataObject methodsUpdateTest = result.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package4.MethodsUpdateTest");
        // 2) modify the MethodsUpdateTest according to the expected result.
        Method getTestStringMethod = methodsUpdateTest.getMethod("getTestString", Arrays.asList(List.class.getName()));
        Type methodReturnType = new TypeImpl(List.class.getName(), Arrays.asList(new TypeImpl(Integer.class.getName())));
        // List<Integer>
        getTestStringMethod.setReturnType(methodReturnType);
        Type parameterType1 = new TypeImpl(List.class.getName(), Arrays.asList(new TypeImpl(List.class.getName(), Arrays.asList(new TypeImpl("org.kie.workbench.common.services.datamodeller.driver.package4.MethodsUpdateTestResult")))));
        Parameter parameter1 = new ParameterImpl(parameterType1, "methodUpdateTestResultList");
        Type parameterType2 = new TypeImpl(int.class.getName());
        Parameter parameter2 = new ParameterImpl(parameterType2, "intParameter");
        getTestStringMethod.getParameters().clear();
        // ( List<List<MethodsUpdateTestResult>> methodUpdateTestResultList, int intParameter )
        getTestStringMethod.setParameters(Arrays.asList(parameter1, parameter2));
        getTestStringMethod.setBody("return Arrays.asList(1);");
        Method noOpMethodWithTestAnnotation = methodsUpdateTest.getMethod("noOpMethodWithTestAnnotation", Collections.EMPTY_LIST);
        noOpMethodWithTestAnnotation.setName("noOpMethodWithTestAnnotationUpdated");
        noOpMethodWithTestAnnotation.setBody("return 1;");
        noOpMethodWithTestAnnotation.setReturnType(new TypeImpl(Integer.class.getName()));
        // @TestAnnotation1("annotationParameterUpdated")
        Annotation testAnnotation = noOpMethodWithTestAnnotation.getAnnotation(TestAnnotation1.class.getName());
        testAnnotation.setValue("value", "annotationParameterUpdated");
        methodsUpdateTest.setName("MethodsUpdateTestResult");
        // 3) compare the modified data object with the expected data object.
        Path expectedFilePath = rootPath.resolve("package4").resolve("MethodsUpdateTestResult.java");
        String expectedSource = ioService.readAllString(expectedFilePath);
        JavaClassSource expectedJavaClassSource = (JavaClassSource) Roaster.parse(expectedSource);
        ModelDriverResult expectedResult = javaRoasterModelDriver.loadDataObject(expectedSource, expectedFilePath);
        DataObject methodsUpdateTestResult = expectedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package4.MethodsUpdateTestResult");
        // First check, the modified data object in memory should be the same as the readed from the model.
        DataModelerAssert.assertEqualsDataObject(methodsUpdateTestResult, methodsUpdateTest);
        // Second check, update the JavaClassSource corresponding to the MethodsUpdateTest
        javaRoasterModelDriver.updateSource(methodsUpdateTestJavaClassSource, methodsUpdateTest, new UpdateInfo(), classTypeResolver);
        ModelDriverResult updatedResult = javaRoasterModelDriver.loadDataObject(methodsUpdateTestJavaClassSource.toString(), methodsUpdateTestFilePath);
        // and now compare the updatedResult with the expected value.
        DataModelerAssert.assertEqualsDataObject(methodsUpdateTestResult, updatedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package4.MethodsUpdateTestResult"));
        logger.debug(methodsUpdateTestJavaClassSource.toString());
    } catch (Exception e) {
        e.printStackTrace();
        fail("Test failed: " + e.getMessage());
    }
}
Also used : Path(org.uberfire.java.nio.file.Path) Description(org.kie.api.definition.type.Description) Arrays(java.util.Arrays) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) Timestamp(org.kie.api.definition.type.Timestamp) Label(org.kie.api.definition.type.Label) TestAnnotation1(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation1) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) LoggerFactory(org.slf4j.LoggerFactory) DataModelerAssert(org.kie.workbench.common.services.datamodeller.DataModelerAssert) Paths(org.uberfire.backend.server.util.Paths) Generated(javax.annotation.Generated) Matcher(java.util.regex.Matcher) Roaster(org.jboss.forge.roaster.Roaster) ClassAnnotation(org.kie.workbench.common.services.datamodeller.annotations.ClassAnnotation) SequenceGenerator(javax.persistence.SequenceGenerator) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) JavaEnum(org.kie.workbench.common.services.datamodeller.core.JavaEnum) URI(java.net.URI) Instance(javax.enterprise.inject.Instance) Entity(javax.persistence.Entity) ParameterImpl(org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl) UniqueConstraint(javax.persistence.UniqueConstraint) ClassReactive(org.kie.api.definition.type.ClassReactive) JavaTypeInfo(org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo) ENUM3(org.kie.workbench.common.services.datamodeller.annotations.ENUM3) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) List(java.util.List) AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) DataModelImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataModelImpl) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) EnumsAnnotation(org.kie.workbench.common.services.datamodeller.annotations.EnumsAnnotation) AnnotationValuesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.AnnotationValuesAnnotation) Role(org.kie.api.definition.type.Role) JavaClassImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaClassImpl) PrimitivesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.PrimitivesAnnotation) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Expires(org.kie.api.definition.type.Expires) TestAnnotation(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation) MarkerAnnotation(org.kie.workbench.common.services.datamodeller.annotations.MarkerAnnotation) Parameter(org.kie.workbench.common.services.datamodeller.core.Parameter) Mock(org.mockito.Mock) Path(org.uberfire.java.nio.file.Path) RunWith(org.junit.runner.RunWith) DriverUtils(org.kie.workbench.common.services.datamodeller.util.DriverUtils) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) Type(org.kie.workbench.common.services.datamodeller.core.Type) ArrayList(java.util.ArrayList) Table(javax.persistence.Table) TypeSafe(org.kie.api.definition.type.TypeSafe) Duration(org.kie.api.definition.type.Duration) DataModel(org.kie.workbench.common.services.datamodeller.core.DataModel) Before(org.junit.Before) Logger(org.slf4j.Logger) JavaEnumImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaEnumImpl) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) IOException(java.io.IOException) Test(org.junit.Test) Method(org.kie.workbench.common.services.datamodeller.core.Method) InputStreamReader(java.io.InputStreamReader) File(java.io.File) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) DataObjectImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataObjectImpl) MethodImpl(org.kie.workbench.common.services.datamodeller.core.impl.MethodImpl) Mockito(org.mockito.Mockito) TestEnums(org.kie.workbench.common.services.datamodeller.annotations.TestEnums) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Position(org.kie.api.definition.type.Position) JavaClass(org.kie.workbench.common.services.datamodeller.core.JavaClass) TypeImpl(org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) IOService(org.uberfire.io.IOService) BufferedReader(java.io.BufferedReader) Key(org.kie.api.definition.type.Key) Assert(org.junit.Assert) Collections(java.util.Collections) Visibility(org.kie.workbench.common.services.datamodeller.core.Visibility) InputStream(java.io.InputStream) TestAnnotation1(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation1) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) Method(org.kie.workbench.common.services.datamodeller.core.Method) ClassAnnotation(org.kie.workbench.common.services.datamodeller.annotations.ClassAnnotation) EnumsAnnotation(org.kie.workbench.common.services.datamodeller.annotations.EnumsAnnotation) AnnotationValuesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.AnnotationValuesAnnotation) PrimitivesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.PrimitivesAnnotation) TestAnnotation(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation) MarkerAnnotation(org.kie.workbench.common.services.datamodeller.annotations.MarkerAnnotation) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) IOException(java.io.IOException) Type(org.kie.workbench.common.services.datamodeller.core.Type) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) ParameterImpl(org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl) Parameter(org.kie.workbench.common.services.datamodeller.core.Parameter) List(java.util.List) ArrayList(java.util.ArrayList) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) TypeImpl(org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl) Test(org.junit.Test)

Aggregations

JavaClassSource (org.jboss.forge.roaster.model.source.JavaClassSource)95 File (java.io.File)37 ArrayList (java.util.ArrayList)28 Test (org.junit.Test)26 ParserResult (org.apache.camel.parser.ParserResult)19 List (java.util.List)15 IOException (java.io.IOException)14 MethodSource (org.jboss.forge.roaster.model.source.MethodSource)12 InputStream (java.io.InputStream)10 Collections (java.util.Collections)10 Roaster (org.jboss.forge.roaster.Roaster)10 BufferedReader (java.io.BufferedReader)8 HashMap (java.util.HashMap)8 Matcher (java.util.regex.Matcher)8 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)8 ObjectProperty (org.kie.workbench.common.services.datamodeller.core.ObjectProperty)8 Arrays (java.util.Arrays)7 Map (java.util.Map)7 Import (org.jboss.forge.roaster.model.source.Import)7 ClassTypeResolver (org.kie.soup.project.datamodel.commons.types.ClassTypeResolver)7