|
33 | 33 |
|
34 | 34 | import java.io.File;
|
35 | 35 | import java.io.IOException;
|
36 |
| -import java.lang.invoke.MethodHandles; |
37 | 36 | import java.net.MalformedURLException;
|
38 | 37 | import java.util.ArrayList;
|
39 | 38 | import java.util.stream.Stream;
|
40 | 39 | import java.util.stream.StreamSupport;
|
41 | 40 |
|
42 |
| -import org.apache.uima.UIMAFramework; |
43 | 41 | import org.apache.uima.analysis_component.Annotator_ImplBase;
|
44 | 42 | import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
|
45 | 43 | import org.apache.uima.analysis_engine.AnalysisEngine;
|
|
57 | 55 | import org.apache.uima.resource.ResourceManager;
|
58 | 56 | import org.apache.uima.resource.metadata.TypeDescription;
|
59 | 57 | import org.apache.uima.resource.metadata.TypeSystemDescription;
|
60 |
| -import org.apache.uima.spi.JCasClassProviderForTesting; |
61 | 58 | import org.apache.uima.test.IsolatingClassloader;
|
62 | 59 | import org.apache.uima.util.InvalidXMLException;
|
63 | 60 | import org.apache.uima.util.XMLInputSource;
|
64 | 61 | import org.assertj.core.api.AutoCloseableSoftAssertions;
|
65 | 62 | import org.junit.jupiter.api.BeforeEach;
|
66 | 63 | import org.junit.jupiter.api.Test;
|
67 |
| -import org.junit.jupiter.api.io.TempDir; |
68 |
| -import org.slf4j.Logger; |
69 |
| -import org.slf4j.LoggerFactory; |
70 |
| - |
71 |
| -import x.y.z.Token; |
72 |
| -import x.y.z.TokenType; |
73 | 64 |
|
74 | 65 | public class JCasClassLoaderTest {
|
75 |
| - private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); |
76 | 66 |
|
77 | 67 | public static final String TYPE_NAME_TOKEN = Token.class.getName();
|
78 | 68 | public static final String TYPE_NAME_ARRAY_HOST = "uima.testing.ArrayHost";
|
@@ -446,44 +436,6 @@ void thatFSArrayToArrayReturnsProperJCasWrapper() throws Exception {
|
446 | 436 | }
|
447 | 437 | }
|
448 | 438 |
|
449 |
| - @Test |
450 |
| - void thatFeatureRangeClassRedefinedInPearDoesNotCauseProblems(@TempDir File aTemp) |
451 |
| - throws Exception { |
452 |
| - var tsd = UIMAFramework.getXMLParser().parseTypeSystemDescription( |
453 |
| - new XMLInputSource("src/test/java/org/apache/uima/jcas/test/generatedx.xml")); |
454 |
| - |
455 |
| - LOG.info("-- Base runtime context --------------------------------------------------"); |
456 |
| - LOG.info("{} loaded using {}", Token.class, Token.class.getClassLoader()); |
457 |
| - LOG.info("{} loaded using {}", TokenType.class, TokenType.class.getClassLoader()); |
458 |
| - |
459 |
| - LOG.info( |
460 |
| - "-- JCas/PEAR-like classloader context ----------------------------------------------"); |
461 |
| - var rootCl = getClass().getClassLoader(); |
462 |
| - var clForCas = new IsolatingClassloader("CAS Classloader", rootCl) // |
463 |
| - .redefining(TokenType.class) // |
464 |
| - .redefining(JCasClassProviderForTesting.class) // |
465 |
| - .redefining(JCasCreator.class); |
466 |
| - |
467 |
| - var jcasCreatorClass = clForCas.loadClass(JCasCreatorImpl.class.getName()); |
468 |
| - var creator = (JCasCreator) jcasCreatorClass.getDeclaredConstructor().newInstance(); |
469 |
| - var jcas = creator.createJCas(clForCas, tsd); |
470 |
| - var cas = jcas.getCas(); |
471 |
| - |
472 |
| - var t = cas.createFS(cas.getTypeSystem().getType(Token.class.getName())); |
473 |
| - var tt = cas.createFS(cas.getTypeSystem().getType(TokenType.class.getName())); |
474 |
| - |
475 |
| - LOG.info("{} loaded using {}", t.getClass(), t.getClass().getClassLoader()); |
476 |
| - LOG.info("{} loaded using {}", tt.getClass(), tt.getClass().getClassLoader()); |
477 |
| - |
478 |
| - assertThat(t.getClass().getClassLoader()) // |
479 |
| - .isSameAs(Token.class.getClassLoader()); |
480 |
| - |
481 |
| - assertThat(tt.getClass().getClassLoader()) // |
482 |
| - .isSameAs(clForCas); |
483 |
| - |
484 |
| - t.setFeatureValue(t.getType().getFeatureByBaseName(Token._FeatName_ttype), tt); |
485 |
| - } |
486 |
| - |
487 | 439 | public static Class<?> loadTokenClass(ClassLoader cl) {
|
488 | 440 | try {
|
489 | 441 | return cl.loadClass(TYPE_NAME_TOKEN);
|
|
0 commit comments