Skip to content

Commit

Permalink
updated performance test (disabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Oct 21, 2019
1 parent d303184 commit b707b27
Showing 1 changed file with 17 additions and 5 deletions.
Expand Up @@ -16,6 +16,7 @@
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -54,13 +55,24 @@ public class PerformanceTest extends BaseSQLRepoTest {

@Test(enabled = false)
public void test100Parsing() throws Exception {
long time = System.currentTimeMillis();
String data = FileUtils.readFileToString(new File(FOLDER_BASIC, "objects.xml"), "utf-8");
String lang = PrismContext.LANG_JSON;

List<PrismObject<? extends Objectable>> list = prismContext.parserFor(data).parseObjects();
String[] dataArray = new String[list.size()];

int COUNT = 1000;
int j = 0;
for (PrismObject o : list) {
dataArray[j] = prismContext.serializerFor(lang).serialize(o);
j++;
}

long time = System.currentTimeMillis();
int COUNT = 10000;
for (int i = 0; i < COUNT; i++) {
List<PrismObject<? extends Objectable>> elements = prismContext.parserFor(new File(FOLDER_BASIC, "objects.xml")).parseObjects();
for (PrismObject obj : elements) {
prismContext.serializerFor(PrismContext.LANG_XML).serialize(obj);
for (String s : dataArray) {
PrismObject o = prismContext.parserFor(s).parse();
prismContext.serializerFor(lang).serialize(o);
}
}
LOGGER.info("xxx>> time: {}", (System.currentTimeMillis() - time));
Expand Down

0 comments on commit b707b27

Please sign in to comment.