Skip to content

Commit

Permalink
repo-sqale: default fullObjectFormat = JSON, yay!
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Oct 1, 2021
1 parent b83a83a commit 1e7ed01
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void init() throws RepositoryServiceFactoryException {

useZip = configuration.getBoolean(PROPERTY_USE_ZIP, false);
useZipAudit = configuration.getBoolean(PROPERTY_USE_ZIP_AUDIT, true);
fullObjectFormat = configuration.getString(PROPERTY_FULL_OBJECT_FORMAT, PrismContext.LANG_XML)
fullObjectFormat = configuration.getString(PROPERTY_FULL_OBJECT_FORMAT, PrismContext.LANG_JSON)
.toLowerCase(); // all language string constants are lower-cases

performanceStatisticsFile = configuration.getString(PROPERTY_PERFORMANCE_STATISTICS_FILE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.testng.annotations.Test;

import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.SerializationOptions;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.repo.api.DeleteObjectResult;
Expand Down Expand Up @@ -2146,11 +2146,15 @@ public void test842AccessCertificationCampaign() throws Exception {
}

private <C extends Containerable> void assertContainerFullObject(byte[] rowFullObject, C sObject) throws Exception {
byte[] serializedSObject = prismContext
.serializerFor(PrismContext.LANG_XML)
byte[] serializeSObject = prismContext
.serializerFor(repositoryConfiguration.getFullObjectFormat())
.options(SerializationOptions
.createSerializeReferenceNamesForNullOids()
.skipIndexOnly(true)
.skipTransient(true))
.serialize(sObject.asPrismContainerValue())
.getBytes(StandardCharsets.UTF_8);
assertThat(rowFullObject).isEqualTo(serializedSObject);
assertThat(rowFullObject).isEqualTo(serializeSObject);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.SerializationOptions;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.path.ItemName;
Expand Down Expand Up @@ -2911,7 +2914,7 @@ private void assertCertificationCaseFullObject(

// Make sure caseBefore contains also container id, otherwise serialization will be different
caseBefore.setId(aRow.cid);
String caseBeforeStr = prismContext.serializerFor(PrismContext.LANG_XML)
String caseBeforeStr = prismContext.serializerFor(repositoryConfiguration.getFullObjectFormat())
.options(SerializationOptions
.createSerializeReferenceNamesForNullOids()
.skipIndexOnly(true)
Expand Down Expand Up @@ -2973,7 +2976,6 @@ public void test332ModifiedCertificationCaseStoresIt()
// Check that case (container) fullObject was updated, as opposed to campaign (object) fullObject
PrismContainerValue<AccessCertificationCaseType> fullObjectCval = prismContext
.parserFor(new String(aRow.fullObject, StandardCharsets.UTF_8))
.xml()
.parseItemValue();

// Unchanged
Expand Down

0 comments on commit 1e7ed01

Please sign in to comment.