Skip to content

Commit

Permalink
Cleaning up some XPath remains
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Aug 30, 2018
1 parent 8bc2af1 commit 45e75e3
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 422 deletions.
Expand Up @@ -399,29 +399,12 @@ public void testPathVariablesPolyStringToStringLong() throws Exception {
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptSimpleXPath() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-simple-xpath.xml",
"testScriptSimpleXPath",
"employeeType", // target
"employeeType", // changed property
"CAPTAIN", "SWASHBUCKLER"); // changed values

// THEN
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, "fooBAR");
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptSimpleGroovy() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-simple-groovy.xml",
"testScriptSimpleXPath",
"testScriptSimpleGroovy",
"employeeType", // target
"employeeType", // changed property
"CAPTAIN", "SWASHBUCKLER"); // changed values
Expand All @@ -433,23 +416,6 @@ public void testScriptSimpleGroovy() throws Exception {
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptVariablesXPath() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-variables-xpath.xml",
"testScriptVariablesXPath",
"employeeType", // target
"employeeType", // changed property
"CAPTAIN", "SWASHBUCKLER"); // changed values

// THEN
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, "Captain barbossa");
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptVariablesGroovy() throws Exception {
// WHEN
Expand All @@ -467,23 +433,6 @@ public void testScriptVariablesGroovy() throws Exception {
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptVariablesPolyStringXPath() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-system-variables-polystring-xpath.xml",
"testScriptVariablesPolyStringXPath",
"fullName", // target
"employeeType", // changed property
"CAPTAIN", "SWASHBUCKLER"); // changed values

// THEN
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, new PolyString("Captain Jack Sparrow", "captain jack sparrow"));
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptVariablesPolyStringGroovy() throws Exception {
// WHEN
Expand Down Expand Up @@ -856,82 +805,12 @@ public void testScriptCustomEnum() throws Exception {
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptRootNodeRef() throws Exception {
// GIVEN
final String TEST_NAME = "testScriptRootNodeRef";
TestUtil.displayTestTitle(TEST_NAME);
MappingImpl<PrismPropertyValue<PolyString>,PrismPropertyDefinition<PolyString>> mapping =
evaluator.<PolyString>createMappingBuilder("mapping-script-root-node.xml", TEST_NAME, "locality", null)
.rootNode(MiscSchemaUtil.createObjectReference(
"c0c010c0-d34d-b33f-f00d-111111111111",
UserType.COMPLEX_TYPE))
.build();

OperationResult opResult = new OperationResult(TEST_NAME);

// WHEN
mapping.evaluate(null, opResult);

// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, new PolyString("Black Pearl", "black pearl"));
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptRootNodeJaxb() throws Exception {
// GIVEN
final String TEST_NAME = "testScriptRootNodeJaxb";
TestUtil.displayTestTitle(TEST_NAME);
PrismObject<UserType> user = PrismTestUtil.parseObject(new File(MidPointTestConstants.OBJECTS_DIR, "c0c010c0-d34d-b33f-f00d-111111111111.xml"));

MappingImpl<PrismPropertyValue<PolyString>,PrismPropertyDefinition<PolyString>> mapping =
evaluator.<PolyString>createMappingBuilder("mapping-script-root-node.xml",
TEST_NAME, "locality", null)
.rootNode(user.asObjectable())
.build();

OperationResult opResult = new OperationResult(TEST_NAME);

// WHEN
mapping.evaluate(null, opResult);

// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, new PolyString("Black Pearl", "black pearl"));
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptListRelativeXPath() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-list-relative-xpath.xml",
"testScriptListRelativeXPath",
"organizationalUnit", // target
"organizationalUnit", // changed property
PrismTestUtil.createPolyString("Antropomorphic Personifications")); // changed values

// THEN
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple,
PrismTestUtil.createPolyString("The Guild of Brethren of the Coast"),
PrismTestUtil.createPolyString("The Guild of Davie Jones' Locker"));
PrismAsserts.assertTriplePlus(outputTriple, PrismTestUtil.createPolyString("The Guild of Antropomorphic Personifications"));
PrismAsserts.assertTripleNoMinus(outputTriple);
}

@Test
public void testScriptListRelativeGroovy() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = evaluator.evaluateMappingDynamicAdd(
"mapping-script-list-relative-groovy.xml",
"testScriptListRelativeXPath",
"testScriptListRelativeGroovy",
"organizationalUnit", // target
"organizationalUnit", // changed property
PrismTestUtil.createPolyString("Antropomorphic Personifications")); // changed values
Expand All @@ -945,12 +824,6 @@ public void testScriptListRelativeGroovy() throws Exception {
PrismAsserts.assertTripleNoMinus(outputTriple);
}


@Test
public void testScriptListAbsoluteXPath() throws Exception {
testScriptListAbsolute("mapping-script-list-absolute-xpath.xml");
}

@Test
public void testScriptListAbsoluteGroovy() throws Exception {
testScriptListAbsolute("mapping-script-list-absolute-groovy.xml");
Expand Down Expand Up @@ -1007,8 +880,6 @@ public void testValueConditionFalse() throws Exception {
assertNull("Unexpected value in outputTriple", outputTriple);
}



@Test
public void testConditionNonEmptyCaptain() throws Exception {
// GIVEN
Expand Down
Expand Up @@ -74,11 +74,6 @@ public void testScriptSystemVariablesConditionAddObjectTrueSourcecontextGroovy()
testScriptSystemVariablesConditionAddObjectTrue("mapping-script-system-variables-condition-sourcecontext-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionAddObjectTrueXPath() throws Exception {
testScriptSystemVariablesConditionAddObjectTrue("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionAddObjectTrue(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionAddObjectTrue";
Expand Down Expand Up @@ -141,11 +136,6 @@ public void testScriptSystemVariablesConditionAddObjectFalseSourcecontextGroovy(
testScriptSystemVariablesConditionAddObjectFalse("mapping-script-system-variables-condition-sourcecontext-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionAddObjectFalseXPath() throws Exception {
testScriptSystemVariablesConditionAddObjectFalse("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionAddObjectFalse(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionAddObjectFalse";
Expand Down Expand Up @@ -180,11 +170,6 @@ public void testScriptSystemVariablesConditionAddObjectFalseNoValSourcecontextGr
testScriptSystemVariablesConditionAddObjectFalseNoVal("mapping-script-system-variables-condition-sourcecontext-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionAddObjectFalseNoValXPath() throws Exception {
testScriptSystemVariablesConditionAddObjectFalseNoVal("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionAddObjectFalseNoVal(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionAddObjectFalseNoVal";
Expand Down Expand Up @@ -219,11 +204,6 @@ public void testScriptSystemVariablesConditionAddObjectFalseNoPropertySourcecont
testScriptSystemVariablesConditionAddObjectFalseNoProperty("mapping-script-system-variables-condition-sourcecontext-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionAddObjectFalseNoPropertyXPath() throws Exception {
testScriptSystemVariablesConditionAddObjectFalseNoProperty("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionAddObjectFalseNoProperty(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionAddObjectFalseNoProperty";
Expand Down Expand Up @@ -254,11 +234,6 @@ public void testScriptSystemVariablesConditionTrueToTrueGroovy() throws Exceptio
testScriptSystemVariablesConditionTrueToTrue("mapping-script-system-variables-condition-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionTrueToTrueXPath() throws Exception {
testScriptSystemVariablesConditionTrueToTrue("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionTrueToTrue(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionTrueToTrue";
Expand Down Expand Up @@ -292,11 +267,6 @@ public void testScriptSystemVariablesConditionFalseToFalseGroovy() throws Except
testScriptSystemVariablesConditionFalseToFalse("mapping-script-system-variables-condition-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionFalseToFalseXPath() throws Exception {
testScriptSystemVariablesConditionFalseToFalse("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionFalseToFalse(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionFalseToFalse";
Expand Down Expand Up @@ -324,11 +294,6 @@ public void testScriptSystemVariablesConditionFalseToTrueGroovy() throws Excepti
testScriptSystemVariablesConditionFalseToTrue("mapping-script-system-variables-condition-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionFalseToTrueXPath() throws Exception {
testScriptSystemVariablesConditionFalseToTrue("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionFalseToTrue(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionFalseToTrue";
Expand Down Expand Up @@ -358,11 +323,6 @@ public void testScriptSystemVariablesConditionTrueToFalseGroovy() throws Excepti
testScriptSystemVariablesConditionTrueToFalse("mapping-script-system-variables-condition-groovy.xml");
}

@Test
public void testScriptSystemVariablesConditionTrueToFalseXPath() throws Exception {
testScriptSystemVariablesConditionTrueToFalse("mapping-script-system-variables-condition-xpath.xml");
}

public void testScriptSystemVariablesConditionTrueToFalse(String filename) throws Exception {
// GIVEN
final String TEST_NAME = "testScriptSystemVariablesConditionTrueToFalse";
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 45e75e3

Please sign in to comment.