@Test
public void testExpansionWithGuvnorEnums() {
GuidedDecisionTable52 model = new GuidedDecisionTable52();
final ProjectDataModelOracle projectLoader = ProjectDataModelOracleBuilder.newProjectOracleBuilder()
.addFact( "Driver" )
.addField( new ModelField( "age",
Integer.class.getName(),
ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS,
ModelField.FIELD_ORIGIN.DECLARED,
FieldAccessorsAndMutators.BOTH,
DataType.TYPE_NUMERIC_INTEGER ) )
.addField( new ModelField( "name",
String.class.getName(),
ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS,
ModelField.FIELD_ORIGIN.DECLARED,
FieldAccessorsAndMutators.BOTH,
DataType.TYPE_STRING ) )
.addField( new ModelField( "dateOfBirth",
Boolean.class.getName(),
ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS,
ModelField.FIELD_ORIGIN.DECLARED,
FieldAccessorsAndMutators.BOTH,
DataType.TYPE_DATE ) )
.addField( new ModelField( "approved",
Boolean.class.getName(),
ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS,
ModelField.FIELD_ORIGIN.DECLARED,
FieldAccessorsAndMutators.BOTH,
DataType.TYPE_BOOLEAN ) )
.end()
.build();
final PackageDataModelOracle packageLoader = PackageDataModelOracleBuilder.newPackageOracleBuilder()
.setProjectOracle( projectLoader )
.addEnum( "'Driver.name' : ['f1a', 'f1b'], 'Driver.age' : ['f2a', 'f2b'], 'Driver.dateOfBirth' : ['f3a', 'f3b'], 'Driver.approved' : ['f4a', 'f4b']",
Thread.currentThread().getContextClassLoader() )
.build();
//Emulate server-to-client conversions
final AsyncPackageDataModelOracle oracle = new AsyncPackageDataModelOracleImpl();
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
dataModel.setModelFields( projectLoader.getProjectModelFields() );
dataModel.setWorkbenchEnumDefinitions( packageLoader.getPackageWorkbenchDefinitions() );
populateDataModelOracle( mock( Path.class ),
model,
oracle,
dataModel );