Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Sep 4, 2015
2 parents 88fd4ff + 532bba2 commit 5123b13
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
Expand Up @@ -30,6 +30,7 @@
import com.evolveum.midpoint.prism.match.MatchingRule;
import com.evolveum.midpoint.prism.match.MatchingRuleRegistry;
import com.evolveum.midpoint.prism.util.ItemPathUtil;
import com.evolveum.midpoint.prism.util.PrismUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -268,6 +269,7 @@ <F extends FocusType> Collection<ItemDelta<?,?>> computeItemDeltas(Map<ItemPath,
continue;
}
}
PrismUtil.setDeltaOldValue(focusOdo.getNewObject(), itemDelta);
}

itemDelta.simplify();
Expand Down
Expand Up @@ -27,13 +27,17 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;

import javax.xml.bind.JAXBException;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeConstants.Field;

import com.evolveum.midpoint.prism.PrismPropertyValue;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.prism.delta.ChangeType;
import com.evolveum.midpoint.prism.delta.PropertyDelta;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.ObjectDeltaOperation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
Expand Down Expand Up @@ -537,7 +541,7 @@ public void test151ModifyJackOrganizationalUnitOffense() throws Exception {
assertEquals("Wrong costCenter", "X000", userJackType.getCostCenter());
assertEquals("Wrong employee number", jackEmployeeNumber, userJackType.getEmployeeNumber());
assertEquals("Wrong telephone number", "1 222 3456789", userJackType.getTelephoneNumber());
assertNull("Unexpected title: "+userJackType.getTitle(), userJackType.getTitle());
assertNull("Unexpected title: " + userJackType.getTitle(), userJackType.getTitle());
// IntegrationTestTools.assertNoExtensionProperty(userJack, PIRACY_COLORS);
}

Expand Down Expand Up @@ -575,7 +579,7 @@ public void test152ModifyJackOrganizationalUnitAddRum() throws Exception {
assertEquals("Wrong costCenter", "X000", userJackType.getCostCenter());
assertEquals("Wrong employee number", jackEmployeeNumber, userJackType.getEmployeeNumber());
assertEquals("Wrong telephone number", "1 222 3456789", userJackType.getTelephoneNumber());
assertNull("Unexpected title: "+userJackType.getTitle(), userJackType.getTitle());
assertNull("Unexpected title: " + userJackType.getTitle(), userJackType.getTitle());
// IntegrationTestTools.assertNoExtensionProperty(userJack, PIRACY_COLORS);
}

Expand Down Expand Up @@ -755,6 +759,8 @@ public void test160ModifyUserGivenNameAgain() throws Exception {
Task task = taskManager.createTaskInstance(TestUserTemplate.class.getName() + ".test160ModifyUserGivenNameAgain");
OperationResult result = task.getResult();

dummyAuditService.clear();

Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
ObjectDelta<UserType> userDelta = ObjectDelta.createModificationReplaceProperty(UserType.class,
USER_JACK_OID, UserType.F_GIVEN_NAME, prismContext, new PolyString("JACKIE"));
Expand All @@ -770,6 +776,22 @@ public void test160ModifyUserGivenNameAgain() throws Exception {
TestUtil.assertSuccess(result);

PrismAsserts.assertPropertyValue(userJack.findContainer(UserType.F_EXTENSION), PIRACY_BAD_LUCK, 123L);

display("Audit", dummyAuditService);
dummyAuditService.assertRecords(2);
dummyAuditService.assertSimpleRecordSanity();
dummyAuditService.assertAnyRequestDeltas();
dummyAuditService.assertExecutionDeltas(1);
dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
dummyAuditService.assertTarget(USER_JACK_OID);
dummyAuditService.assertExecutionSuccess();
ObjectDeltaOperation<?> objectDeltaOperation = dummyAuditService.getExecutionDelta(0);
assertEquals("unexpected number of modifications in audited delta", 4, objectDeltaOperation.getObjectDelta().getModifications().size()); // givenName + badLuck + modifyTimestamp
PropertyDelta badLuckDelta = objectDeltaOperation.getObjectDelta().findPropertyDelta(new ItemPath(UserType.F_EXTENSION, PIRACY_BAD_LUCK));
assertNotNull("badLuck delta was not found", badLuckDelta);
List<PrismValue> oldValues = (List<PrismValue>) badLuckDelta.getEstimatedOldValues();
assertNotNull("badLuck delta has null estimatedOldValues field", oldValues);
PrismAsserts.assertEqualsCollectionUnordered("badLuck delta has wrong estimatedOldValues", oldValues, new PrismPropertyValue<Long>(123L), new PrismPropertyValue<Long>(456L));
}

@Test
Expand Down
20 changes: 20 additions & 0 deletions samples/rest/query-all-tasks.xml
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
~ Copyright (c) 2010-2014 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<q:query xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
<!-- empty query = return all records -->
</q:query>
25 changes: 25 additions & 0 deletions samples/rest/query-livesync-tasks.xml
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!--
~ Copyright (c) 2010-2014 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<q:query xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
<q:filter>
<q:equal>
<q:path>category</q:path>
<q:value>LiveSynchronization</q:value>
</q:equal>
</q:filter>
</q:query>

0 comments on commit 5123b13

Please sign in to comment.