Author: schor Date: Fri May 13 20:07:13 2016 New Revision: 1743741 URL: http://svn.apache.org/viewvc?rev=1743741&view=rev Log: [UIMA-4674] _typeImpl not final (to support ll_setInt backward compatibility), change refs to it to _getTypeImpl() for protection, plus minor updates to tests
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/FSBagIndexTest.java uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FeatureStructureTest.java uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/FSBagIndexTest.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/FSBagIndexTest.java?rev=1743741&r1=1743740&r2=1743741&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/FSBagIndexTest.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/FSBagIndexTest.java Fri May 13 20:07:13 2016 @@ -112,8 +112,8 @@ public class FSBagIndexTest extends Test r.add(it.get()); it.moveToNext(); } - Collections.sort(r, (fs1, fs2) -> Integer.compare(fs1._id, fs2._id)); - Arrays.sort(ns, (fs1, fs2) -> Integer.compare(fs1._id, fs2._id)); + Collections.sort(r); + Arrays.sort(ns); assertTrue(Arrays.equals(ns, r.toArray())); assertFalse(it.isValid()); } Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java?rev=1743741&r1=1743740&r2=1743741&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/SerDesTest6.java Fri May 13 20:07:13 2016 @@ -82,6 +82,7 @@ public class SerDesTest6 extends TestCas private static long seed; // -8,093,220,039,004,886,811 // final private static Random random = setRandom(seed = -8093220039004886811L); +// final private static Random random = setRandom(seed = -7_080_877_499_529_731_700L); final private static Random random = setRandom(); static { System.out.format("SerDesTest6 RandomSeed: %,d%n", seed); } private final String testDocText = "test document text"; @@ -581,6 +582,7 @@ public class SerDesTest6 extends TestCas private void serdesDelta(TTypeSystem m) { remoteCas = setupCas(m); // create empty new CAS with specified type system from m.ts + casSrc.reset(); loadCas(casSrc, mSrc); // load up the src cas using mSrc spec ReuseInfo[] ri = serializeDeserialize(casSrc, remoteCas, null, null); //src -> serialize -> deserialize -> rmt Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FeatureStructureTest.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FeatureStructureTest.java?rev=1743741&r1=1743740&r2=1743741&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FeatureStructureTest.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FeatureStructureTest.java Fri May 13 20:07:13 2016 @@ -254,7 +254,7 @@ public class FeatureStructureTest extend Annotation fs = cas.getFsFromId(tokId); assertTrue(fs == token); assertTrue(fs.id() == token.id()); - assertEquals(ts.annotType, fs._typeImpl); + assertEquals(ts.annotType, fs._getTypeImpl()); assertEquals(fs.getBegin(), 3); assertEquals(fs.getEnd(), 5); assertEquals(sofa, fs.getSofa()); @@ -283,7 +283,7 @@ public class FeatureStructureTest extend TOP ttt = cas.getFsFromId(tokId); assertTrue(ttt != token); assertTrue(ttt.id() == tokId); - assertEquals(ttt._typeImpl, tokenTypeType); + assertEquals(ttt._getTypeImpl(), tokenTypeType); assertTrue(fsa.get(0) == ttt); assertTrue(fsl.getHead() == ttt); Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java?rev=1743741&r1=1743740&r2=1743741&view=diff ============================================================================== --- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java (original) +++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java Fri May 13 20:07:13 2016 @@ -715,6 +715,7 @@ public class IteratorTest extends TestCa boolean ok = false; try { it.moveToNext(); + it.get(); // for set/sorted, the get does the actual "move" operation } catch (ConcurrentModificationException e) { ok = true; } @@ -1004,7 +1005,7 @@ public class IteratorTest extends TestCa FSIndex<FeatureStructure> setIndex = this.cas.getIndexRepository().getIndex( CASTestSetup.ANNOT_SET_INDEX, this.tokenType); - FSIterator<FeatureStructure> setIt = setIndex.iterator(); + FSIterator<FeatureStructure> set_iterator = setIndex.iterator(); FSIndex<AnnotationFS> sortedIndex = this.cas.getAnnotationIndex(this.tokenType); FSIterator<AnnotationFS> sortedIt = sortedIndex.iterator(); @@ -1019,9 +1020,9 @@ public class IteratorTest extends TestCa // For each index, check that the FSs are actually in the index. for (int i = 0; i < fsArray.length; i++) { - setIt.moveTo(fsArray[i]); - assertTrue(setIt.isValid()); - assertTrue(setIt.get().equals(fsArray[(i < 90) ? i : 90])); + set_iterator.moveTo(fsArray[i]); + assertTrue(set_iterator.isValid()); + assertTrue(set_iterator.get().equals(fsArray[(i < 90) ? i : 90])); bagIt.moveTo(fsArray[i]); assertTrue(bagIt.isValid()); @@ -1049,17 +1050,15 @@ public class IteratorTest extends TestCa for (int i = 0; i < fsArray.length; i++) { ir.removeFS(fsArray[i]); ir.removeFS(fsArray[i]); // a 2nd remove should be a no-op https://issues.apache.org/jira/browse/UIMA-2934 - setIt.moveTo(fsArray[i]); - if (setIt.isValid()) { + set_iterator.moveTo(fsArray[i]); + if (set_iterator.isValid()) { int oldRef = this.cas.ll_getFSRef(fsArray[i]); - int newRef = this.cas.ll_getFSRef(setIt.get()); + int newRef = this.cas.ll_getFSRef(set_iterator.get()); assertTrue(oldRef != newRef); - assertTrue(!setIt.get().equals(fsArray[i])); + assertTrue(!set_iterator.get().equals(fsArray[i])); } bagIt.moveTo(fsArray[i]); - if (bagIt.isValid()) { - assertTrue(!bagIt.get().equals(fsArray[i])); - } + assertFalse(bagIt.hasNext()); sortedIt.moveTo(fsArray[i]); if (sortedIt.isValid()) { assertTrue(!sortedIt.get().equals(fsArray[i])); @@ -1073,8 +1072,8 @@ public class IteratorTest extends TestCa // All iterators should be invalidated when being reset. bagIt.moveToFirst(); assertFalse(bagIt.isValid()); - setIt.moveToFirst(); - assertFalse(setIt.isValid()); + set_iterator.moveToFirst(); + assertFalse(set_iterator.isValid()); sortedIt.moveToFirst(); assertFalse(sortedIt.isValid()); } @@ -1186,10 +1185,13 @@ public class IteratorTest extends TestCa } catch (Exception e) { caught = true; } + if (it.isValid()) { + it.isValid(); // debug + assertTrue(caught); // v3: it becomes invalid + } // if (caught != true) { // System.out.println("Debug"); // } - assertTrue(caught); }