Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.kie.workbench.common.services.datamodel.backend.server;
  
  import java.util.Set;
  
  import  org.drools.workbench.models.commons.backend.oracle.ProjectDataModelOracleImpl;
  import  org.drools.workbench.models.datamodel.oracle.Annotation;
  import  org.drools.workbench.models.datamodel.oracle.TypeSource;
  import org.junit.Test;
  import  org.kie.api.definition.type.Role;
 
 import static org.junit.Assert.*;
 import static org.kie.workbench.common.services.datamodel.backend.server.ProjectDataModelOracleTestUtils.*;

Tests for Fact's annotations
 
 
     @Test
     public void testProjectDMOZeroAnnotationAttributes() throws Exception {
         final ProjectDataModelOracleBuilder builder = ProjectDataModelOracleBuilder.newProjectOracleBuilder();
         final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl();
 
         final ClassFactBuilder cb = new ClassFactBuilderbuilder,
                                                           Product.class,
                                                           false,
                                                           TypeSource.JAVA_PROJECT );
         cb.buildoracle );
 
         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" );
         assertNotNullannotations );
         assertEquals( 0,
                       annotations.size() );
     }
 
     @Test
     public void testProjectDMOAnnotationAttributes() throws Exception {
         final ProjectDataModelOracleBuilder builder = ProjectDataModelOracleBuilder.newProjectOracleBuilder();
         final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl();
 
         final ClassFactBuilder cb = new ClassFactBuilderbuilder,
                                                           Smurf.class,
                                                           false,
                                                           TypeSource.JAVA_PROJECT );
         cb.buildoracle );
 
         assertEquals( 1,
                       oracle.getProjectModelFields().size() );
         assertContains"org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.Smurf",
                         oracle.getProjectModelFields().keySet() );
 
         final Set<Annotation> annotations = oracle.getProjectTypeAnnotations().get( "org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.Smurf" );
         assertNotNullannotations );
         assertEquals( 1,
                       annotations.size() );
 
         final Annotation annotation = annotations.iterator().next();
         assertEquals"org.kie.workbench.common.services.datamodel.backend.server.testclasses.annotations.SmurfDescriptor",
                       annotation.getQualifiedTypeName() );
         assertEquals"blue",
                       annotation.getAttributes().get( "colour" ) );
         assertEquals"M",
                       annotation.getAttributes().get( "gender" ) );
         assertEquals"Brains",
                       annotation.getAttributes().get( "description" ) );
     }
 
     @Test
     public void testProjectDMOAnnotationAttributes2() throws Exception {
         final ProjectDataModelOracleBuilder builder = ProjectDataModelOracleBuilder.newProjectOracleBuilder();
         final ProjectDataModelOracleImpl oracle = new ProjectDataModelOracleImpl();
 
         final ClassFactBuilder cb = new ClassFactBuilderbuilder,
                                                           RoleSmurf.class,
                                                           false,
                                                           TypeSource.JAVA_PROJECT );
         cb.buildoracle );
 
         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" );
         assertNotNullannotations );
         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" ) );
    }
New to GrepCode? Check out our FAQ X