use of org.exist.collections.Collection in project exist by eXist-db.
the class DefaultDocumentSetTest method contains_leftRight.
@Test
public void contains_leftRight() {
final Collection col = mockCollection(1);
final DocumentImpl doc1 = mockDoc(col, 1);
final DocumentImpl doc6 = mockDoc(col, 6);
final DocumentImpl doc9 = mockDoc(col, 9);
final DocumentImpl doc15 = mockDoc(col, 15);
final DocumentImpl doc34 = mockDoc(col, 34);
replay(col, doc1, doc6, doc9, doc15, doc34);
final DefaultDocumentSet set1 = new DefaultDocumentSet();
set1.add(doc1);
set1.add(doc6);
set1.add(doc9);
final DefaultDocumentSet set2 = new DefaultDocumentSet();
set2.add(doc1);
set2.add(doc6);
set2.add(doc9);
set2.add(doc15);
set2.add(doc34);
// functions under test
assertTrue(set2.contains(set1));
assertFalse(set1.contains(set2));
verify(col, doc1, doc6, doc9, doc15, doc34);
}
use of org.exist.collections.Collection in project exist by eXist-db.
the class DefaultDocumentSetTest method equalDocs_noMatch.
@Test
public void equalDocs_noMatch() {
final Collection col = mockCollection(1);
final DocumentImpl doc1 = mockDoc(col, 1);
final DocumentImpl doc6 = mockDoc(col, 6);
final DocumentImpl doc9 = mockDoc(col, 9);
final DocumentImpl doc15 = mockDoc(col, 15);
final DocumentImpl doc34 = mockDoc(col, 34);
replay(col, doc1, doc6, doc9, doc15, doc34);
final DefaultDocumentSet set1 = new DefaultDocumentSet();
set1.add(doc1);
set1.add(doc6);
set1.add(doc9);
set1.add(doc15);
set1.add(doc34);
final DefaultDocumentSet set2 = new DefaultDocumentSet();
set2.add(doc1);
set2.add(doc6);
set2.add(doc9);
// functions under test
assertFalse(set1.equalDocs(set2));
assertFalse(set2.equalDocs(set1));
verify(col, doc1, doc6, doc9, doc15, doc34);
}
use of org.exist.collections.Collection in project exist by eXist-db.
the class DefaultDocumentSetTest method contains_noMatch.
@Test
public void contains_noMatch() {
final Collection col = mockCollection(1);
final DocumentImpl doc1 = mockDoc(col, 1);
final DocumentImpl doc6 = mockDoc(col, 6);
final DocumentImpl doc9 = mockDoc(col, 9);
final DocumentImpl doc15 = mockDoc(col, 15);
final DocumentImpl doc34 = mockDoc(col, 34);
replay(col, doc1, doc6, doc9, doc15, doc34);
final DefaultDocumentSet set1 = new DefaultDocumentSet();
set1.add(doc1);
set1.add(doc6);
set1.add(doc9);
final DefaultDocumentSet set2 = new DefaultDocumentSet();
set2.add(doc15);
set2.add(doc34);
// functions under test
assertFalse(set2.contains(set1));
assertFalse(set1.contains(set2));
verify(col, doc1, doc6, doc9, doc15, doc34);
}
use of org.exist.collections.Collection in project exist by eXist-db.
the class DefaultDocumentSetTest method contains_nonOptimized_rightLeft.
@Test
public void contains_nonOptimized_rightLeft() {
final Collection col = mockCollection(1);
final DocumentImpl doc1 = mockDoc(col, 1);
final DocumentImpl doc6 = mockDoc(col, 6);
final DocumentImpl doc9 = mockDoc(col, 9);
final DocumentImpl doc15 = mockDoc(col, 15);
final DocumentImpl doc34 = mockDoc(col, 34);
final DefaultDocumentSet set1 = new DefaultDocumentSet();
final DocumentSet set2 = testableDocumentSet(doc1, doc6, doc9);
replay(col, set2, doc1, doc6, doc9, doc15, doc34);
set1.add(doc1);
set1.add(doc6);
set1.add(doc9);
set1.add(doc15);
set1.add(doc34);
// functions under test
assertTrue(set1.contains(set2));
verify(col, set2, doc1, doc6, doc9, doc15, doc34);
}
use of org.exist.collections.Collection in project exist by eXist-db.
the class TwoDatabasesTest method setUp.
@Before
public void setUp() throws Exception {
final BrokerPool pool1 = existEmbeddedServer1.getBrokerPool();
user1 = pool1.getSecurityManager().getSystemSubject();
try (final DBBroker broker1 = pool1.get(Optional.of(user1))) {
final Collection top1 = broker1.getCollection(XmldbURI.create("xmldb:exist:///"));
assertTrue(top1 != null);
}
final BrokerPool pool2 = existEmbeddedServer2.getBrokerPool();
user2 = pool2.getSecurityManager().getSystemSubject();
try (final DBBroker broker2 = pool2.get(Optional.of(user2))) {
final Collection top2 = broker2.getCollection(XmldbURI.create("xmldb:exist:///"));
assertTrue(top2 != null);
}
}
Aggregations