@@ -104,7 +104,6 @@ public class QBFailover extends BasicJavaClientREST {
104104 private static final String query1 = "fn:count(fn:doc())" ;
105105 private static String [] hostNames ;
106106 private static JobTicket ticket ;
107- private static List <String > outputList ;
108107 private static final String TEST_DIR_PREFIX = "/WriteHostBatcher-testdata/" ;
109108
110109 @ BeforeClass
@@ -140,15 +139,9 @@ public static void setUpBeforeClass() throws Exception {
140139 }
141140 hostLists .add ("localhost" );
142141 int index = new Random ().nextInt (hostLists .size ());
143- if (isLBHost ()) {
144- dbClient = getDatabaseClient (user , password , getConnType ());
145- evalClient = dbClient ;
146- }
147- else {
148- dbClient = getDatabaseClientOnDatabase (hostLists .get (index ), port , dbName , user , password ,
142+ dbClient = getDatabaseClientOnDatabase (hostLists .get (index ), port , dbName , user , password ,
149143 Authentication .DIGEST );
150- evalClient = getDatabaseClientOnDatabase (host , port , dbName , user , password , Authentication .DIGEST );
151- }
144+ evalClient = getDatabaseClientOnDatabase (host , port , dbName , user , password , Authentication .DIGEST );
152145 dmManager = dbClient .newDataMovementManager ();
153146 tempMgr = evalClient .newDataMovementManager ();
154147 Map <String , String > props = new HashMap <>();
@@ -291,14 +284,12 @@ public void setUp() throws Exception {
291284 addDocs ();
292285 waitForForest ("after" );
293286 Assert .assertTrue (evalClient .newServerEval ().xquery (query1 ).eval ().next ().getNumber ().intValue () == 20000 );
294- if (!isLBHost ()) {
295- ForestConfiguration fc = dmManager .readForestConfig ();
296- Forest [] f = fc .listForests ();
297- f = (Forest []) Arrays .stream (f ).filter (x -> x .getDatabaseName ().equals (dbName )).collect (Collectors .toList ())
298- .toArray (new Forest [hostNames .length ]);
299- Assert .assertEquals (f .length , hostNames .length );
300- Assert .assertEquals (f .length , 3L );
301- }
287+ ForestConfiguration fc = dmManager .readForestConfig ();
288+ Forest [] f = fc .listForests ();
289+ f = (Forest []) Arrays .stream (f ).filter (x -> x .getDatabaseName ().equals (dbName )).collect (Collectors .toList ())
290+ .toArray (new Forest [hostNames .length ]);
291+ Assert .assertEquals (f .length , hostNames .length );
292+ Assert .assertEquals (f .length , 3L );
302293 } else {
303294 System .out .println ("Test skipped - setUp" );
304295 }
@@ -340,7 +331,7 @@ private void waitForForest(String testStatus) throws InterruptedException {
340331 @ After
341332 public void tearDown () throws Exception {
342333 // Perform the setup on multiple nodes only.
343- if (hostNames .length > 1 && ! isLBHost () ) {
334+ if (hostNames .length > 1 ) {
344335 System .out .println ("Restarting servers" );
345336 for (int i = hostNames .length - 1 ; i >= 1 ; i --) {
346337 System .out .println ("Restarting server " + hostNames [i ]);
@@ -634,7 +625,7 @@ public void testStopTwoNodes() throws Exception {
634625 AtomicBoolean isNode3Running = new AtomicBoolean (true );
635626 AtomicBoolean isNode2Running = new AtomicBoolean (true );
636627 QueryBatcher batcher = dmManager .newQueryBatcher (new StructuredQueryBuilder ().collection ("XmlTransform" ))
637- .withBatchSize (25 ).withThreadCount (10 );
628+ .withBatchSize (5 ).withThreadCount (6 );
638629
639630 HostAvailabilityListener .getInstance (batcher ).withSuspendTimeForHostUnavailable (Duration .ofSeconds (15 ))
640631 .withMinHosts (1 );
@@ -722,9 +713,7 @@ public void xQueryMasstransformReplace() throws Exception {
722713 System .out .println ("State is :" + getForestState ("QBFailover-2-replica" ));
723714 AtomicInteger modified = new AtomicInteger (0 );
724715 AtomicBoolean passed = new AtomicBoolean (true );
725- System .out .println ("Finished transforming" );
726-
727- QueryBatcher readBatcher = tempMgr .newQueryBatcher (outputList .iterator ())
716+ QueryBatcher readBatcher = tempMgr .newQueryBatcher (new StructuredQueryBuilder ().collection ("XmlTransform" ))
728717 .withBatchSize (10 ).withThreadCount (5 ).onUrisReady ((batch ) -> {
729718 DocumentPage page = batch .getClient ().newDocumentManager ().read (batch .getItems ());
730719 while (page .hasNext ()) {
@@ -1112,10 +1101,9 @@ private void addDocs() {
11121101 });
11131102
11141103 dmManager .startJob (ihb2 );
1115- outputList = new ArrayList < String >();
1104+
11161105 for (int j = 0 ; j < 20000 ; j ++) {
11171106 String uri = "/local/string-" + j ;
1118- outputList .add (uri );
11191107 ihb2 .add (uri , meta2 , stringHandle );
11201108 }
11211109 ihb2 .flushAndWait ();
0 commit comments