Skip to content

Commit

Permalink
test: fixed broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Jun 30, 2023
1 parent bae4766 commit 5364986
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

import java.io.*;
import java.time.*;
import java.time.format.*;
import java.util.*;
import java.util.concurrent.atomic.*;

Expand All @@ -58,14 +57,13 @@
* From Discussion https://github.com/ArcadeData/arcadedb/discussions/1129#discussioncomment-6226545
*/
public class ConsoleAsyncInsertTest {
static final String DATABASE_NAME = "ConsoleAsyncInsertTest";
static final int PARALLEL_LEVEL = 6;
static final String RECORD_TIME_FORMAT_PATTERN = "yyyyMMdd'_'HHmmss.SSSSSS";
static final DateTimeFormatter RECORD_TIME_FORMAT = DateTimeFormatter.ofPattern(RECORD_TIME_FORMAT_PATTERN);
static final String DATABASE_NAME = "ConsoleAsyncInsertTest";
static final int PARALLEL_LEVEL = 6;
static final String RECORD_TIME_FORMAT_PATTERN = "yyyyMMdd'_'HHmmss.SSSSSS";
final String userName = "root";
final String password = com.arcadedb.server.BaseGraphServerTest.DEFAULT_PASSWORD_FOR_TESTS;

AtomicInteger autoIncrementOrderId = new AtomicInteger(0);
String userName = "testUser";
String password = "testPassword";

private static class Product {
private final String fileName;
Expand Down Expand Up @@ -187,8 +185,6 @@ public void testBulkAsyncInsertProductsUsingSQL() {

try {
ServerSecurity serverSecurity = arcadeDBServer.getSecurity();
final String userName = "root";
final String password = com.arcadedb.server.BaseGraphServerTest.DEFAULT_PASSWORD_FOR_TESTS;
if (serverSecurity.getUser(userName) == null) {
serverSecurity.createUser(new JSONObject().put("name", userName).put("password", serverSecurity.encodePassword(password))
.put("databases", new JSONObject().put(DATABASE_NAME, new JSONArray(new String[] { "admin" }))));
Expand Down Expand Up @@ -218,7 +214,7 @@ public void testBulkAsyncInsertProductsUsingSQL() {
inventoryProductAsyncWithSQL(database, product, okCount, errCount);
}

checkResults(txErrorCounter, userName, password, database, okCount, errCount, N, begin);
checkResults(txErrorCounter, database, okCount, errCount, N, begin);
} finally {
arcadeDBServer.stop();
FileUtils.deleteRecursively(new File(arcadeDBServer.getRootPath() + File.separator + "config"));
Expand Down Expand Up @@ -268,8 +264,6 @@ public void testBulkAsyncInsertProductsUsingAPI() {

try {
ServerSecurity serverSecurity = arcadeDBServer.getSecurity();
final String userName = "root";
final String password = com.arcadedb.server.BaseGraphServerTest.DEFAULT_PASSWORD_FOR_TESTS;
if (serverSecurity.getUser(userName) == null) {
serverSecurity.createUser(new JSONObject().put("name", userName).put("password", serverSecurity.encodePassword(password))
.put("databases", new JSONObject().put(DATABASE_NAME, new JSONArray(new String[] { "admin" }))));
Expand Down Expand Up @@ -299,7 +293,7 @@ public void testBulkAsyncInsertProductsUsingAPI() {
inventoryProductAsyncWithAPI(database, product, okCount, errCount);
}

checkResults(txErrorCounter, userName, password, database, okCount, errCount, N, begin);
checkResults(txErrorCounter, database, okCount, errCount, N, begin);
} finally {
arcadeDBServer.stop();
FileUtils.deleteRecursively(new File(arcadeDBServer.getRootPath() + File.separator + "config"));
Expand Down Expand Up @@ -406,8 +400,7 @@ public void testOrderByAfterDeleteInsert() {
}
}

private static void checkResults(AtomicLong txErrorCounter, String userName, String password, Database database, AtomicLong okCount, AtomicLong errCount,
long N, long begin) {
private void checkResults(AtomicLong txErrorCounter, Database database, AtomicLong okCount, AtomicLong errCount, long N, long begin) {
Assertions.assertTrue(database.async().waitCompletion(30_000));

System.out.println("Total async insertion of " + N + " elements in " + (System.currentTimeMillis() - begin));
Expand Down

0 comments on commit 5364986

Please sign in to comment.