Search in sources :

Example 26 with DefinitionSpace

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()));
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 27 with DefinitionSpace

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());
}
Also used : DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Domain(io.vertigo.dynamo.domain.metamodel.Domain) FormatterDefault(io.vertigo.dynamox.domain.formatter.FormatterDefault) Test(org.junit.Test)

Example 28 with DefinitionSpace

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());
}
Also used : DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) FormatterDefault(io.vertigo.dynamox.domain.formatter.FormatterDefault) FormatterDefinition(io.vertigo.dynamo.domain.metamodel.FormatterDefinition) Test(org.junit.Test)

Example 29 with DefinitionSpace

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);
}
Also used : DslDefinition(io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.jupiter.api.Test)

Aggregations

DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)29 Test (org.junit.Test)18 SearchIndexDefinition (io.vertigo.dynamo.search.metamodel.SearchIndexDefinition)9 Domain (io.vertigo.dynamo.domain.metamodel.Domain)6 FacetedQueryDefinition (io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)4 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)4 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)4 FormatterDefault (io.vertigo.dynamox.domain.formatter.FormatterDefault)4 ListFilter (io.vertigo.dynamo.collections.ListFilter)3 FacetDefinition (io.vertigo.dynamo.collections.metamodel.FacetDefinition)3 FormatterDefinition (io.vertigo.dynamo.domain.metamodel.FormatterDefinition)3 Task (io.vertigo.dynamo.task.model.Task)3 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)2 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)2 DslDefinition (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition)2 Item (io.vertigo.dynamo.search.data.domain.Item)2 ItemDataBase (io.vertigo.dynamo.search.data.domain.ItemDataBase)2 Car (io.vertigo.dynamo.search_2_4.data.domain.Car)2 CarDataBase (io.vertigo.dynamo.search_2_4.data.domain.CarDataBase)2 TaskResult (io.vertigo.dynamo.task.model.TaskResult)2