Search in sources :

Example 71 with ObjectBundleParams

use of org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleParams in project dhis2-core by dhis2.

the class AtomicModeIntegrationTest method setUpTest.

@Override
public void setUpTest() throws Exception {
    renderService = _renderService;
    userService = _userService;
    Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(new ClassPathResource("tracker/simple_metadata.json").getInputStream(), RenderFormat.JSON);
    ObjectBundleParams params = new ObjectBundleParams();
    params.setObjectBundleMode(ObjectBundleMode.COMMIT);
    params.setImportStrategy(ImportStrategy.CREATE);
    params.setObjects(metadata);
    ObjectBundle bundle = objectBundleService.create(params);
    ObjectBundleValidationReport validationReport = objectBundleValidationService.validate(bundle);
    assertFalse(validationReport.hasErrorReports());
    objectBundleService.commit(bundle);
    userA = userService.getUser("M5zQapPyTZI");
    injectSecurityContext(userA);
}
Also used : ObjectBundleParams(org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleParams) ObjectBundle(org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundle) ObjectBundleValidationReport(org.hisp.dhis.dxf2.metadata.objectbundle.feedback.ObjectBundleValidationReport) List(java.util.List) ClassPathResource(org.springframework.core.io.ClassPathResource) IdentifiableObject(org.hisp.dhis.common.IdentifiableObject)

Aggregations

ObjectBundleValidationReport (org.hisp.dhis.dxf2.metadata.objectbundle.feedback.ObjectBundleValidationReport)65 List (java.util.List)62 IdentifiableObject (org.hisp.dhis.common.IdentifiableObject)62 ClassPathResource (org.springframework.core.io.ClassPathResource)61 Test (org.junit.jupiter.api.Test)52 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)39 DataElement (org.hisp.dhis.dataelement.DataElement)32 User (org.hisp.dhis.user.User)25 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)20 DataSet (org.hisp.dhis.dataset.DataSet)18 ObjectBundleParams (org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleParams)18 UserAuthorityGroup (org.hisp.dhis.user.UserAuthorityGroup)18 ObjectBundle (org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundle)17 DhisSpringTest (org.hisp.dhis.DhisSpringTest)9 OptionSet (org.hisp.dhis.option.OptionSet)9 ValidationRule (org.hisp.dhis.validation.ValidationRule)7 CategoryCombo (org.hisp.dhis.category.CategoryCombo)6 Section (org.hisp.dhis.dataset.Section)5 Test (org.junit.Test)5 IOException (java.io.IOException)4