use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.
the class JavaEnvironmentManagerTest method testCityFragment.
@Test
public void testCityFragment() {
final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
final DtDefinition dtDefinition = definitionSpace.resolve("DT_CITY_FRAGMENT", DtDefinition.class);
Assert.assertFalse(dtDefinition.isPersistent());
Assert.assertTrue(dtDefinition.getFragment().isPresent());
Assert.assertTrue("City".equals(dtDefinition.getFragment().get().getClassSimpleName()));
Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain.CityFragment", dtDefinition.getClassCanonicalName());
Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain", dtDefinition.getPackageName());
Assert.assertEquals("CityFragment", dtDefinition.getClassSimpleName());
Assert.assertTrue("City".equals(dtDefinition.getField("CIT_ID").getFkDtDefinition().getClassSimpleName()));
}
use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.
the class JavaEnvironmentManagerTest method testDomain.
@Test
public void testDomain() {
final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
final io.vertigo.dynamo.domain.metamodel.Domain domain = definitionSpace.resolve("DO_ID", Domain.class);
Assert.assertEquals(DataType.Long, domain.getDataType());
Assert.assertEquals(FormatterDefault.class.getName(), domain.getFormatterClassName());
}
use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.
the class JavaEnvironmentManagerTest method testDefaultFormatter.
@Test
public void testDefaultFormatter() {
final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
final FormatterDefinition formatter = definitionSpace.resolve("FMT_DEFAULT", FormatterDefinition.class);
Assert.assertEquals(FormatterDefault.class.getName(), formatter.getFormatterClassName());
}
use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.
the class EnvironmentManagerTest method simpleTest.
@Test
public void simpleTest() {
final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
final DslDefinition address1Definition = DslDefinition.builder("MOCK_MAIN_ADDRESS", PersonGrammar.ADDRESS_ENTITY).withPackageName("io.vertigo.test.model").addPropertyValue(STREET, "1, rue du louvre").addPropertyValue(POSTAL_CODE, "75008").addPropertyValue(CITY, "Paris").build();
dslDefinitionRepository.addDefinition(address1Definition);
final DslDefinition address2Definition = DslDefinition.builder("MOCK_SECOND_ADDRESS", PersonGrammar.ADDRESS_ENTITY).withPackageName("io.vertigo.test.model").addPropertyValue(STREET, "105, rue martin").addPropertyValue(POSTAL_CODE, "75008").addPropertyValue(CITY, "Paris CEDEX").build();
dslDefinitionRepository.addDefinition(address2Definition);
final DslDefinition personDefinition = DslDefinition.builder("MOCK_MISTER_BEAN", PersonGrammar.PERSON_ENTITY).withPackageName("io.vertigo.test.model").addPropertyValue(NAME, "105, rue martin").addPropertyValue(FIRST_NAME, "75008").addPropertyValue(AGE, 42).addPropertyValue(HEIGHT, 175.0d).addPropertyValue(MALE, Boolean.TRUE).addDefinitionLink(MAIN_ADDRESS, "MOCK_MAIN_ADDRESS").addDefinitionLink(PersonGrammar.SECOND_ADDRESS, "MOCK_SECOND_ADDRESS").build();
dslDefinitionRepository.addDefinition(personDefinition);
dslDefinitionRepository.solve(definitionSpace);
assertNotNull(personDefinition);
}
Aggregations