-
Notifications
You must be signed in to change notification settings - Fork 572
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 ce79347
Showing
2,109 changed files
with
111,828 additions
and
9 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
54 changes: 54 additions & 0 deletions
54
...server-api/src/test/java/org/kie/server/api/marshalling/json/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,54 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package org.kie.server.api.marshalling.json; | ||
|
||
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.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; | ||
|
||
public class JSONMarshallerLargeTest { | ||
|
||
private Logger logger = LoggerFactory.getLogger(JSONMarshallerLargeTest.class); | ||
|
||
@Test(timeout = 5000L) | ||
public void testLargeNumberOfClasses() throws IOException { | ||
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); | ||
} | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...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,29 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
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; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...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,52 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@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; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...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,52 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@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; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
.../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,52 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@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; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...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,52 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
package org.kie.server.api.marshalling.test.model.dummy.package1; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
@SuppressWarnings("java:S1068") | ||
@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.