Search in sources :

Example 11 with Validations

use of io.jans.scim.model.scim2.Validations in project atlasmap by atlasmap.

the class KafkaConnectModule method processPreValidation.

@Override
public void processPreValidation(AtlasInternalSession session) throws AtlasException {
    if (session == null || session.getMapping() == null) {
        throw new AtlasValidationException("Invalid session: Session and AtlasMapping must be specified");
    }
    Validations validations = session.getValidations();
    KafkaConnectValidationService kafkaConnectValidationService = new KafkaConnectValidationService(getConversionService(), getFieldActionService());
    kafkaConnectValidationService.setMode(getMode());
    kafkaConnectValidationService.setDocId(getDocId());
    List<Validation> kafkaConnectValidations = kafkaConnectValidationService.validateMapping(session.getMapping());
    if (kafkaConnectValidations != null && !kafkaConnectValidations.isEmpty()) {
        validations.getValidation().addAll(kafkaConnectValidations);
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("Detected " + kafkaConnectValidations.size() + " json validation notices");
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("{}: processPreValidation completed", getDocId());
    }
}
Also used : Validation(io.atlasmap.v2.Validation) Validations(io.atlasmap.v2.Validations) AtlasValidationException(io.atlasmap.api.AtlasValidationException)

Example 12 with Validations

use of io.jans.scim.model.scim2.Validations in project atlasmap by atlasmap.

the class JavaJavaFlatMappingTest method testProcessJavaJavaFlatFieldMappingPrimitivesBoxedValues.

@Test
public void testProcessJavaJavaFlatFieldMappingPrimitivesBoxedValues() throws Exception {
    AtlasContext context = atlasContextFactory.createContext(new File("src/test/resources/javaToJava/atlasmapping-flatprimitive.json").toURI());
    AtlasSession session = context.createSession();
    BaseFlatPrimitiveClass sourceClass = generateFlatPrimitiveClassPrimitiveFieldsBoxedValues(SourceFlatPrimitiveClass.class);
    session.setDefaultSourceDocument(sourceClass);
    context.process(session);
    Object object = session.getDefaultTargetDocument();
    assertNotNull(object);
    assertTrue(object instanceof TargetFlatPrimitiveClass);
    validateFlatPrimitiveClassPrimitiveFields((TargetFlatPrimitiveClass) object);
    Validations validations = session.getValidations();
    for (Validation v : validations.getValidation()) {
        printValidation(v);
    }
}
Also used : Validation(io.atlasmap.v2.Validation) Validations(io.atlasmap.v2.Validations) TargetFlatPrimitiveClass(io.atlasmap.java.test.TargetFlatPrimitiveClass) AtlasContext(io.atlasmap.api.AtlasContext) BaseFlatPrimitiveClass(io.atlasmap.java.test.BaseFlatPrimitiveClass) File(java.io.File) AtlasSession(io.atlasmap.api.AtlasSession) AtlasMappingBaseTest(io.atlasmap.itests.reference.AtlasMappingBaseTest) Test(org.junit.jupiter.api.Test)

Example 13 with Validations

use of io.jans.scim.model.scim2.Validations in project atlasmap by atlasmap.

the class AtlasCoreValidationTest method testMappingNameNull.

@Test
public void testMappingNameNull() throws AtlasException {
    assertNotNull(context);
    assertNotNull(session);
    context.processValidation(session);
    Validations validations = session.getValidations();
    assertNotNull(validations);
    assertNotNull(validations.getValidation());
    assertFalse(validations.getValidation().isEmpty());
    boolean found = false;
    for (Validation v : validations.getValidation()) {
        if ("Mapping name must not be null nor empty".equals(v.getMessage())) {
            found = true;
            assertEquals(ValidationStatus.ERROR, v.getStatus());
            assertEquals(ValidationScope.ALL, v.getScope());
        }
        System.out.println(AtlasValidationTestHelper.validationToString(v));
    }
    assertTrue(found);
}
Also used : Validation(io.atlasmap.v2.Validation) Validations(io.atlasmap.v2.Validations) Test(org.junit.jupiter.api.Test) AtlasMappingBaseTest(io.atlasmap.itests.validation.AtlasMappingBaseTest)

Example 14 with Validations

use of io.jans.scim.model.scim2.Validations in project atlasmap by atlasmap.

the class AtlasCoreValidationTest method testJsonToJava.

@Test
public void testJsonToJava() throws AtlasException {
    assertNotNull(context);
    assertNotNull(session);
    context.processValidation(session);
    Validations validations = session.getValidations();
    assertNotNull(validations);
    assertNotNull(validations.getValidation());
    assertTrue(validations.getValidation().isEmpty());
}
Also used : Validations(io.atlasmap.v2.Validations) Test(org.junit.jupiter.api.Test) AtlasMappingBaseTest(io.atlasmap.itests.validation.AtlasMappingBaseTest)

Example 15 with Validations

use of io.jans.scim.model.scim2.Validations in project atlasmap by atlasmap.

the class AtlasCoreValidationTest method testXmlToJava.

@Test
public void testXmlToJava() throws AtlasException {
    assertNotNull(context);
    assertNotNull(session);
    context.processValidation(session);
    Validations validations = session.getValidations();
    assertNotNull(validations);
    assertNotNull(validations.getValidation());
    assertTrue(validations.getValidation().isEmpty());
}
Also used : Validations(io.atlasmap.v2.Validations) Test(org.junit.jupiter.api.Test) AtlasMappingBaseTest(io.atlasmap.itests.validation.AtlasMappingBaseTest)

Aggregations

Validations (io.atlasmap.v2.Validations)26 Test (org.junit.jupiter.api.Test)11 Validation (io.atlasmap.v2.Validation)9 Test (org.junit.Test)9 AtlasMappingBaseTest (io.atlasmap.itests.validation.AtlasMappingBaseTest)8 AtlasMappingBaseTest (io.atlasmap.validation.AtlasMappingBaseTest)8 AtlasSession (io.atlasmap.api.AtlasSession)5 AtlasContext (io.atlasmap.api.AtlasContext)4 SCIMException (io.jans.scim.model.exception.SCIMException)4 Audits (io.atlasmap.v2.Audits)3 File (java.io.File)3 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)3 AtlasValidationException (io.atlasmap.api.AtlasValidationException)2 BaseFlatPrimitiveClass (io.atlasmap.java.test.BaseFlatPrimitiveClass)2 TargetFlatPrimitiveClass (io.atlasmap.java.test.TargetFlatPrimitiveClass)2 DuplicateEntryException (io.jans.orm.exception.operation.DuplicateEntryException)2 AtlasMappingBaseTest (io.atlasmap.itests.reference.AtlasMappingBaseTest)1 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)1 Head (io.atlasmap.spi.AtlasInternalSession.Head)1 AtlasMapping (io.atlasmap.v2.AtlasMapping)1