You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2013/03/21 02:38:33 UTC
svn commit: r1459124 -
/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java
Author: schor
Date: Thu Mar 21 01:38:33 2013
New Revision: 1459124
URL: http://svn.apache.org/r1459124
Log:
[UIMA-2498] add test case for fs ref chain going through filtered-out type
Modified:
uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java
Modified: uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java?rev=1459124&r1=1459123&r2=1459124&view=diff
==============================================================================
--- uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java (original)
+++ uima/uimaj/branches/filteredCompress-uima-2498/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest.java Thu Mar 21 01:38:33 2013
@@ -23,6 +23,7 @@ import static org.apache.uima.cas.impl.S
import static org.apache.uima.cas.impl.SerDesTest.TypeSystems.TwoTypes;
import static org.apache.uima.cas.impl.SerDesTest.TypeSystems.TwoTypesNoFeatures;
import static org.apache.uima.cas.impl.SerDesTest.TypeSystems.TwoTypesSubsetFeatures;
+import static org.apache.uima.cas.impl.SerDesTest.TypeSystems.OneType;
import static org.apache.uima.cas.impl.SerDesTest.Types.Akof1;
import static org.apache.uima.cas.impl.SerDesTest.Types.Akof2;
@@ -223,7 +224,7 @@ public class SerDesTest extends TestCase
public SerDesTest() {
Random sg = new Random();
long seed = sg.nextLong();
-// seed = 4666441987103258042L;
+// seed = 1536337128105529870L;
random = new Random(seed);
System.out.format("RandomSeed: %,d%n", seed);
@@ -281,7 +282,50 @@ public class SerDesTest extends TestCase
public void tearDown() {
}
+
+ // Test chains going through filtered type
+ // Repeat below with OneType, and TwoTypes with filtered slot == fsRef
+
+ // T1 fsArray ref -> T2 -> T1 (new) (not indexed)
+ // T1 ref -> T2 -> T1 (new) (not indexed)
+ // T1 fsArray ref -> T2 -> T1 (new) (indexed)
+ // T1 ref -> T2 -> T1 (new) (indexed)
+ public void testRefThroughFilteredType() throws IOException {
+ reftft (OneType);
+ for (int i = 0; i < 10; i++) {
+ reftft (TwoTypesSubsetFeatures);
+ }
+ reftft(TwoTypesNoFeatures);
+ }
+
+ private void reftft(TypeSystems tskind) {
+ reftft(tskind, true);
+ reftft(tskind, false);
+ }
+
+ private void reftft(TypeSystems tskind, boolean indexed) {
+ lfs.clear();
+
+ TTypeSystem m = getTT(tskind);
+ remoteCas = setupCas(m);
+
+ TTypeSystem mSrc = getTT(TwoTypes);
+ makeFeaturesForAkof(casSrc, mSrc, Akof1);
+
+ FeatureStructure otherTsFs = casSrc.createFS(mSrc.getType(Akof2));
+ FeatureStructure fsOrig = lfs.get(0);
+ fsOrig.setFeatureValue(mSrc.getFeature(fsOrig, "Fs"), otherTsFs);
+
+ FeatureStructure ts1Fs = casSrc.createFS(mSrc.getType(Akof1));
+ otherTsFs.setFeatureValue(mSrc.getFeature(otherTsFs, "Fs"), ts1Fs);
+
+ if (indexed) {
+ casSrc.addFsToIndexes(ts1Fs);
+ }
+
+ verify(remoteCas);
+ }
// broken out special instances of random tests
public void testDeltaWithStringArrayMod() throws IOException {
// casSrc -> remoteCas,remoteCas updated, serialized back to srcCas