@@ -280,6 +280,8 @@ public void testAndWordQueryWithMultipleForests() throws Exception
280
280
{
281
281
String testMultipleDB = "QBMultipleForestDB" ;
282
282
String [] testMultipleForest = {"QBMultipleForestDB-1" , "QBMultipleForestDB-2" , "QBMultipleForestDB-3" };
283
+ DatabaseClient clientTmp = null ;
284
+ DataMovementManager dmManagerTmp = null ;
283
285
284
286
try {
285
287
System .out .println ("Running testAndWordQueryWithMultipleForests" );
@@ -291,19 +293,22 @@ public void testAndWordQueryWithMultipleForests() throws Exception
291
293
associateRESTServerWithDB (restServerName , testMultipleDB );
292
294
293
295
setupAppServicesConstraint (testMultipleDB );
296
+ Thread .sleep (10000 );
294
297
295
298
String [] filenames = {"constraint1.xml" , "constraint2.xml" , "constraint3.xml" , "constraint4.xml" , "constraint5.xml" };
296
299
String queryOptionName = "absRangeConstraintWithVariousGrammarAndWordQueryOpt.xml" ;
300
+ clientTmp = DatabaseClientFactory .newClient (restServerHost , restServerPort , "eval-user" , "x" , Authentication .DIGEST );
301
+ dmManagerTmp = clientTmp .newDataMovementManager ();
297
302
298
- setQueryOption (clientQHB , queryOptionName );
303
+ setQueryOption (clientTmp , queryOptionName );
299
304
300
- QueryManager queryMgr = clientQHB .newQueryManager ();
305
+ QueryManager queryMgr = clientTmp .newQueryManager ();
301
306
302
307
StringQueryDefinition querydef = queryMgr .newStringDefinition ();
303
308
querydef .setCriteria ("0012" );
304
309
305
310
//Use WriteBatcher to write the same files.
306
- WriteBatcher batcher = dmManager .newWriteBatcher ();
311
+ WriteBatcher batcher = dmManagerTmp .newWriteBatcher ();
307
312
308
313
batcher .withBatchSize (2 );
309
314
InputStreamHandle contentHandle1 = new InputStreamHandle ();
@@ -332,7 +337,7 @@ public void testAndWordQueryWithMultipleForests() throws Exception
332
337
StringBuilder batchFailResults = new StringBuilder ();
333
338
334
339
// Run a QueryBatcher on the new URIs.
335
- QueryBatcher queryBatcher1 = dmManager .newQueryBatcher (querydef );
340
+ QueryBatcher queryBatcher1 = dmManagerTmp .newQueryBatcher (querydef );
336
341
337
342
queryBatcher1 .onUrisReady (batch -> {
338
343
for (String str : batch .getItems ()) {
@@ -346,7 +351,7 @@ public void testAndWordQueryWithMultipleForests() throws Exception
346
351
batchFailResults .append ("Test has Exceptions" );
347
352
} );
348
353
349
- JobTicket jobTicket = dmManager .startJob (queryBatcher1 );
354
+ JobTicket jobTicket = dmManagerTmp .startJob (queryBatcher1 );
350
355
boolean bJobFinished = queryBatcher1 .awaitTermination (3 , TimeUnit .MINUTES );
351
356
352
357
if (queryBatcher1 .isStopped ()) {
@@ -374,6 +379,8 @@ public void testAndWordQueryWithMultipleForests() throws Exception
374
379
375
380
deleteForest (testMultipleForest [0 ]);
376
381
deleteForest (testMultipleForest [1 ]);
382
+ Thread .sleep (10000 );
383
+ clientTmp .release ();
377
384
}
378
385
}
379
386
@@ -1149,6 +1156,7 @@ public void testQueryBatcherWithForestRemoveAndAdd() throws IOException, Interru
1149
1156
deleteForest (testMultipleForest [0 ]);
1150
1157
deleteForest (testMultipleForest [1 ]);
1151
1158
deleteForest (testMultipleForest [2 ]);
1159
+ Thread .sleep (10000 );
1152
1160
}
1153
1161
}
1154
1162
@@ -1268,6 +1276,7 @@ public void testBatchClientLookupTimeout() throws IOException, InterruptedExcept
1268
1276
detachForest (testMultipleDB , testMultipleForest [0 ]);
1269
1277
deleteDB (testMultipleDB );
1270
1278
deleteForest (testMultipleForest [0 ]);
1279
+ Thread .sleep (10000 );
1271
1280
}
1272
1281
}
1273
1282
@@ -1386,6 +1395,8 @@ public void testQueryBatcherJobDetails() throws Exception
1386
1395
{
1387
1396
String testMultipleDB = "QHBJobDetaitDB" ;
1388
1397
String [] testMultipleForest = {"QHBJobDetaitDB-1" };
1398
+ DatabaseClient clientTmp = null ;
1399
+ DataMovementManager dmManagerTmp = null ;
1389
1400
1390
1401
try {
1391
1402
System .out .println ("Running testQueryBatcherJobDetails" );
@@ -1396,19 +1407,22 @@ public void testQueryBatcherJobDetails() throws Exception
1396
1407
associateRESTServerWithDB (restServerName , testMultipleDB );
1397
1408
1398
1409
setupAppServicesConstraint (testMultipleDB );
1410
+ Thread .sleep (10000 );
1399
1411
1400
1412
String [] filenames = {"constraint1.xml" , "constraint2.xml" , "constraint3.xml" , "constraint4.xml" , "constraint5.xml" };
1401
1413
String queryOptionName = "absRangeConstraintWithVariousGrammarAndWordQueryOpt.xml" ;
1414
+ clientTmp = DatabaseClientFactory .newClient (restServerHost , restServerPort , "eval-user" , "x" , Authentication .DIGEST );
1415
+ dmManagerTmp = clientTmp .newDataMovementManager ();
1402
1416
1403
- setQueryOption (clientQHB , queryOptionName );
1417
+ setQueryOption (clientTmp , queryOptionName );
1404
1418
1405
- QueryManager queryMgr = clientQHB .newQueryManager ();
1419
+ QueryManager queryMgr = clientTmp .newQueryManager ();
1406
1420
1407
1421
StringQueryDefinition querydef = queryMgr .newStringDefinition ();
1408
1422
querydef .setCriteria ("0012" );
1409
1423
1410
1424
//Use WriteBatcher to write the same files.
1411
- WriteBatcher batcher = dmManager .newWriteBatcher ();
1425
+ WriteBatcher batcher = dmManagerTmp .newWriteBatcher ();
1412
1426
1413
1427
batcher .withBatchSize (2 );
1414
1428
InputStreamHandle contentHandle1 = new InputStreamHandle ();
@@ -1438,7 +1452,7 @@ public void testQueryBatcherJobDetails() throws Exception
1438
1452
StringBuilder batchFailResults = new StringBuilder ();
1439
1453
1440
1454
// Run a QueryBatcher on the new URIs.
1441
- QueryBatcher queryBatcher1 = dmManager .newQueryBatcher (querydef );
1455
+ QueryBatcher queryBatcher1 = dmManagerTmp .newQueryBatcher (querydef );
1442
1456
1443
1457
queryBatcher1 .onUrisReady (batch -> {
1444
1458
for (String str : batch .getItems ()) {
@@ -1471,7 +1485,7 @@ public void testQueryBatcherJobDetails() throws Exception
1471
1485
batchFailResults .append ("Test has Exceptions" );
1472
1486
} );
1473
1487
1474
- JobTicket jobTicket = dmManager .startJob (queryBatcher1 );
1488
+ JobTicket jobTicket = dmManagerTmp .startJob (queryBatcher1 );
1475
1489
String jobId = jobTicket .getJobId ();
1476
1490
String jobName = jobTicket .getJobType ().name ();
1477
1491
@@ -1519,6 +1533,8 @@ public void testQueryBatcherJobDetails() throws Exception
1519
1533
deleteDB (testMultipleDB );
1520
1534
1521
1535
deleteForest (testMultipleForest [0 ]);
1536
+ Thread .sleep (10000 );
1537
+ clientTmp .release ();
1522
1538
}
1523
1539
}
1524
1540
@@ -1534,32 +1550,38 @@ public void testDifferentQueryTypes() throws Exception
1534
1550
{
1535
1551
String testMultipleDB = "QBtestDifferentQueryTypesDB" ;
1536
1552
String [] testMultipleForest = {"QBtestDifferentQueryTypesDB-1" };
1553
+ DatabaseClient clientTmp = null ;
1554
+ DataMovementManager dmManagerTmp = null ;
1537
1555
1538
1556
try {
1539
1557
System .out .println ("Running testDifferentQueryTypes" );
1540
1558
1541
1559
//Setup a separate database/
1542
- createDB (testMultipleDB );
1543
- createForest (testMultipleForest [0 ], testMultipleDB );
1544
-
1560
+ createDB (testMultipleDB );
1561
+ createForest (testMultipleForest [0 ], testMultipleDB );
1545
1562
associateRESTServerWithDB (restServerName , testMultipleDB );
1546
-
1563
+
1564
+ // Setup constraints on DB and wait for indexes to setup.
1547
1565
setupAppServicesConstraint (testMultipleDB );
1566
+ Thread .sleep (10000 );
1548
1567
1549
1568
String [] filenames = {"constraint1.xml" , "constraint2.xml" , "constraint3.xml" , "constraint4.xml" , "constraint5.xml" };
1550
1569
ServerConfigurationManager srvMgr = client .newServerConfigManager ();
1551
1570
srvMgr .readConfiguration ();
1552
1571
srvMgr .setQueryOptionValidation (true );
1553
1572
srvMgr .writeConfiguration ();
1573
+
1574
+ clientTmp = DatabaseClientFactory .newClient (restServerHost , restServerPort , "eval-user" , "x" , Authentication .DIGEST );
1575
+ dmManagerTmp = clientTmp .newDataMovementManager ();
1554
1576
1555
- QueryManager queryMgr = clientQHB .newQueryManager ();
1577
+ QueryManager queryMgr = clientTmp .newQueryManager ();
1556
1578
1557
1579
// create query def
1558
1580
StructuredQueryBuilder qb = queryMgr .newStructuredQueryBuilder ();
1559
1581
StructuredQueryDefinition queryWorddef = qb .word (qb .element ("id" ), "0026" );
1560
1582
1561
- //Use WriteBatcher to write the same files.
1562
- WriteBatcher batcher = dmManager .newWriteBatcher ();
1583
+ //Use WriteBatcher to write the some files.
1584
+ WriteBatcher batcher = dmManagerTmp .newWriteBatcher ();
1563
1585
1564
1586
batcher .withBatchSize (2 );
1565
1587
InputStreamHandle contentHandle1 = new InputStreamHandle ();
@@ -1581,12 +1603,13 @@ public void testDifferentQueryTypes() throws Exception
1581
1603
1582
1604
// Flush
1583
1605
batcher .flushAndWait ();
1606
+ //batcher.awaitCompletion();
1584
1607
1585
1608
StringBuilder batchWordResults = new StringBuilder ();
1586
1609
StringBuilder batchWordFailResults = new StringBuilder ();
1587
1610
1588
1611
// Run a QueryBatcher on the new URIs.
1589
- QueryBatcher queryBatcher1 = dmManager .newQueryBatcher (queryWorddef );
1612
+ QueryBatcher queryBatcher1 = dmManagerTmp .newQueryBatcher (queryWorddef );
1590
1613
1591
1614
queryBatcher1 .onUrisReady (batch -> {
1592
1615
for (String str : batch .getItems ()) {
@@ -1599,7 +1622,7 @@ public void testDifferentQueryTypes() throws Exception
1599
1622
throwable .printStackTrace ();
1600
1623
batchWordFailResults .append ("Test has Exceptions" );
1601
1624
} );
1602
- JobTicket jobTicket = dmManager .startJob (queryBatcher1 );
1625
+ JobTicket jobTicket = dmManagerTmp .startJob (queryBatcher1 );
1603
1626
boolean bJobFinished = queryBatcher1 .awaitTermination (3 , TimeUnit .MINUTES );
1604
1627
while (!queryBatcher1 .isStopped ()) {
1605
1628
// do nothing.
@@ -1620,7 +1643,7 @@ public void testDifferentQueryTypes() throws Exception
1620
1643
// Run a range query.
1621
1644
1622
1645
StructuredQueryDefinition queryRangedef = qb .range (qb .element ("popularity" ), "xs:integer" , Operator .GE , 4 );
1623
- QueryBatcher queryBatcher2 = dmManager .newQueryBatcher (queryRangedef );
1646
+ QueryBatcher queryBatcher2 = dmManagerTmp .newQueryBatcher (queryRangedef );
1624
1647
//StringBuilder batchRangeResults = new StringBuilder();
1625
1648
List <String > batchRangeResults = new ArrayList <String >();
1626
1649
StringBuilder batchRangeFailResults = new StringBuilder ();
@@ -1637,7 +1660,7 @@ public void testDifferentQueryTypes() throws Exception
1637
1660
throwable .printStackTrace ();
1638
1661
batchRangeFailResults .append ("Test has Exceptions" );
1639
1662
} );
1640
- jobTicket = dmManager .startJob (queryBatcher2 );
1663
+ jobTicket = dmManagerTmp .startJob (queryBatcher2 );
1641
1664
bJobFinished = queryBatcher2 .awaitTermination (3 , TimeUnit .MINUTES );
1642
1665
while (!queryBatcher2 .isStopped ()) {
1643
1666
// do nothing.
@@ -1660,7 +1683,7 @@ public void testDifferentQueryTypes() throws Exception
1660
1683
// Run a ValueQueryOnAttribute query.
1661
1684
1662
1685
StructuredQueryDefinition valuequeyDef = qb .value (qb .elementAttribute (qb .element (new QName ("http://cloudbank.com" , "price" )), qb .attribute ("amt" )), "0.1" );
1663
- QueryBatcher queryBatcher3 = dmManager .newQueryBatcher (valuequeyDef );
1686
+ QueryBatcher queryBatcher3 = dmManagerTmp .newQueryBatcher (valuequeyDef );
1664
1687
//StringBuilder batchRangeResults = new StringBuilder();
1665
1688
List <String > batchValueResults = new ArrayList <String >();
1666
1689
StringBuilder batchvalueFailResults = new StringBuilder ();
@@ -1675,7 +1698,7 @@ public void testDifferentQueryTypes() throws Exception
1675
1698
throwable .printStackTrace ();
1676
1699
batchvalueFailResults .append ("Test has Exceptions" );
1677
1700
} );
1678
- jobTicket = dmManager .startJob (queryBatcher3 );
1701
+ jobTicket = dmManagerTmp .startJob (queryBatcher3 );
1679
1702
bJobFinished = queryBatcher3 .awaitTermination (3 , TimeUnit .MINUTES );
1680
1703
while (!queryBatcher3 .isStopped ()) {
1681
1704
// do nothing.
@@ -1702,6 +1725,8 @@ public void testDifferentQueryTypes() throws Exception
1702
1725
detachForest (testMultipleDB , testMultipleForest [0 ]);
1703
1726
deleteDB (testMultipleDB );
1704
1727
deleteForest (testMultipleForest [0 ]);
1728
+ clientTmp .release ();
1729
+ Thread .sleep (10000 );
1705
1730
}
1706
1731
}
1707
1732
}
0 commit comments