-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[incubator-kie-issues-1105] Polymorphic json typing causes long delay…
…s in first request
- Loading branch information
1 parent
16a50c2
commit 7b270d4
Showing
2,109 changed files
with
73,998 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...er-parent/kie-server-api/src/test/java/com/example/manyrules/JSONMarshallerLargeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.example.manyrules; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import org.drools.core.util.IoUtils; | ||
import org.junit.Test; | ||
import org.kie.server.api.marshalling.json.JSONMarshaller; | ||
import org.kie.server.api.marshalling.test.model.Fact; | ||
import org.reflections.Reflections; | ||
import org.reflections.scanners.SubTypesScanner; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assume.assumeThat; | ||
|
||
public class JSONMarshallerLargeTest { | ||
|
||
private Logger logger = LoggerFactory.getLogger(JSONMarshallerLargeTest.class); | ||
|
||
@Test(timeout=5000L) | ||
public void testLargeNumberOfClasses() throws IOException { | ||
assumeThat(JSONMarshaller.isDefaultTypingActivate(), is(false)); | ||
try (InputStream is = JSONMarshallerLargeTest.class.getClassLoader().getResourceAsStream("complex_payload.json")) { | ||
String content = new String(IoUtils.readBytesFromInputStream(is)); | ||
|
||
Reflections reflections = new Reflections("org.kie.server.api.marshalling.test.model", new SubTypesScanner(false)); | ||
Set<Class<?>> clazzes = reflections.getSubTypesOf(Object.class).stream().collect(Collectors.toSet()); | ||
clazzes.remove(Fact.class); | ||
|
||
JSONMarshaller marshaller = new JSONMarshaller(clazzes, JSONMarshallerLargeTest.class.getClassLoader()); | ||
Fact object = marshaller.unmarshall(content, Fact.class); | ||
assertThat(object).isNotNull(); | ||
logger.info("object captured {}", object); | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...r-parent/kie-server-api/src/test/java/org/kie/server/api/marshalling/test/model/Fact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.kie.server.api.marshalling.test.model; | ||
|
||
public class Fact implements java.io.Serializable { | ||
|
||
private Object object; | ||
|
||
public Object getObject() { | ||
return object; | ||
} | ||
|
||
public void setObject(Object object) { | ||
this.object = object; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...pi/src/test/java/org/kie/server/api/marshalling/test/model/dummy/package1/DummyData1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import lombok.Data; | ||
import javax.xml.bind.annotation.*; | ||
|
||
import java.io.Serializable; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@Data | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "DummyData1") | ||
public class DummyData1 implements Serializable { | ||
|
||
private static final long serialVersionUID = 5174127032991892033L; | ||
|
||
@XmlAttribute(name = "dummyString") | ||
private String dummyString; | ||
private int dummyInt; | ||
@XmlElement(required = true) | ||
private Object dummyObj; | ||
|
||
public DummyData1() { | ||
} | ||
|
||
public DummyData1(int dummyInt, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyObj = dummyObj; | ||
} | ||
|
||
public DummyData1(int dummyInt, String dummyString, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyString = dummyString; | ||
this.dummyObj = dummyObj; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...i/src/test/java/org/kie/server/api/marshalling/test/model/dummy/package1/DummyData10.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import lombok.Data; | ||
import javax.xml.bind.annotation.*; | ||
|
||
import java.io.Serializable; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@Data | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "DummyData10") | ||
public class DummyData10 implements Serializable { | ||
|
||
private static final long serialVersionUID = 5174127032991892033L; | ||
|
||
@XmlAttribute(name = "dummyString") | ||
private String dummyString; | ||
private int dummyInt; | ||
@XmlElement(required = true) | ||
private Object dummyObj; | ||
|
||
public DummyData10() { | ||
} | ||
|
||
public DummyData10(int dummyInt, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyObj = dummyObj; | ||
} | ||
|
||
public DummyData10(int dummyInt, String dummyString, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyString = dummyString; | ||
this.dummyObj = dummyObj; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
.../src/test/java/org/kie/server/api/marshalling/test/model/dummy/package1/DummyData100.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import lombok.Data; | ||
import javax.xml.bind.annotation.*; | ||
|
||
import java.io.Serializable; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@Data | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "DummyData100") | ||
public class DummyData100 implements Serializable { | ||
|
||
private static final long serialVersionUID = 5174127032991892033L; | ||
|
||
@XmlAttribute(name = "dummyString") | ||
private String dummyString; | ||
private int dummyInt; | ||
@XmlElement(required = true) | ||
private Object dummyObj; | ||
|
||
public DummyData100() { | ||
} | ||
|
||
public DummyData100(int dummyInt, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyObj = dummyObj; | ||
} | ||
|
||
public DummyData100(int dummyInt, String dummyString, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyString = dummyString; | ||
this.dummyObj = dummyObj; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...i/src/test/java/org/kie/server/api/marshalling/test/model/dummy/package1/DummyData11.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import lombok.Data; | ||
import javax.xml.bind.annotation.*; | ||
|
||
import java.io.Serializable; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@Data | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "DummyData11") | ||
public class DummyData11 implements Serializable { | ||
|
||
private static final long serialVersionUID = 5174127032991892033L; | ||
|
||
@XmlAttribute(name = "dummyString") | ||
private String dummyString; | ||
private int dummyInt; | ||
@XmlElement(required = true) | ||
private Object dummyObj; | ||
|
||
public DummyData11() { | ||
} | ||
|
||
public DummyData11(int dummyInt, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyObj = dummyObj; | ||
} | ||
|
||
public DummyData11(int dummyInt, String dummyString, Object dummyObj) { | ||
this.dummyInt = dummyInt; | ||
this.dummyString = dummyString; | ||
this.dummyObj = dummyObj; | ||
} | ||
} |
Oops, something went wrong.