use of org.hisp.dhis.schema.SchemaService in project dhis2-core by dhis2.
the class GeoJsonAttributesCheckTest method setUpTest.
@BeforeEach
public void setUpTest() {
organisationUnit = new OrganisationUnit();
organisationUnit.setName("A");
attribute = new Attribute();
attribute.setUid("geoJson");
attribute.setName("geoJson");
validationContext = Mockito.mock(ValidationContext.class);
Schema schema = new Schema(OrganisationUnit.class, "organisationUnit", "organisationUnits");
Property property = new Property();
property.setPersisted(true);
schema.getPropertyMap().put("attributeValues", property);
SchemaService schemaService = Mockito.mock(SchemaService.class);
when(schemaService.getDynamicSchema(OrganisationUnit.class)).thenReturn(schema);
when(validationContext.getSchemaService()).thenReturn(schemaService);
Preheat preheat = Mockito.mock(Preheat.class);
when(preheat.getAttributeIdsByValueType(OrganisationUnit.class, ValueType.GEOJSON)).thenReturn(Sets.newSet("geoJson"));
objectBundle = Mockito.mock(ObjectBundle.class);
when(objectBundle.getPreheat()).thenReturn(preheat);
}
use of org.hisp.dhis.schema.SchemaService in project dhis2-core by dhis2.
the class DefaultFieldFilterServiceTest method setUp.
@BeforeEach
public void setUp() {
final Set<NodeTransformer> nodeTransformers = new HashSet<>();
nodeTransformers.add(new PluckNodeTransformer());
final SchemaService schemaService = new DefaultSchemaService(new DefaultPropertyIntrospectorService(new JacksonPropertyIntrospector()), sessionFactory);
CacheProvider cacheProvider = mock(CacheProvider.class);
when(cacheProvider.createPropertyTransformerCache()).thenReturn(new NoOpCache<>());
service = new DefaultFieldFilterService(new DefaultFieldParser(), schemaService, aclService, currentUserService, attributeService, cacheProvider, userGroupService, userService, nodeTransformers);
service.init();
}
Aggregations