@Test public void testProjectDMOAnnotationAttributes2() throws Exception { final ProjectDataModelOracleBuilder builder = ProjectDataModelOracleBuilder.newProjectOracleBuilder(); final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl(); final ClassFactBuilder cb = new ClassFactBuilder(builder, RoleSmurf.class, false, TypeSource.JAVA_PROJECT); cb.build(oracle); assertEquals(1, oracle.getProjectModelFields().size()); assertContains( "org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.RoleSmurf", oracle.getProjectModelFields().keySet()); final Set<Annotation> annotations = oracle .getProjectTypeAnnotations() .get( "org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.RoleSmurf"); assertNotNull(annotations); assertEquals(1, annotations.size()); final Annotation annotation = annotations.iterator().next(); assertEquals("org.kie.api.definition.type.Role", annotation.getQualifiedTypeName()); assertEquals(Role.Type.EVENT.name(), annotation.getAttributes().get("value")); }
@Test public void testProjectDMOZeroAnnotationAttributes() throws Exception { final ProjectDataModelOracleBuilder builder = ProjectDataModelOracleBuilder.newProjectOracleBuilder(); final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl(); final ClassFactBuilder cb = new ClassFactBuilder(builder, Product.class, false, TypeSource.JAVA_PROJECT); cb.build(oracle); assertEquals(1, oracle.getProjectModelFields().size()); assertContains( "org.kie.workbench.common.services.datamodel.backend.server.testclasses.Product", oracle.getProjectModelFields().keySet()); final Set<Annotation> annotations = oracle .getProjectTypeAnnotations() .get("org.kie.workbench.common.services.datamodel.backend.server.testclasses.Product"); assertNotNull(annotations); assertEquals(0, annotations.size()); }