Skip to content

Commit

Permalink
Merge branch 'main' into delete-reuse-space
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Oct 20, 2024
2 parents 8fc2271 + 4be4860 commit e0483e5
Show file tree
Hide file tree
Showing 315 changed files with 7,771 additions and 6,798 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/meterian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ jobs:
uses: actions/checkout@v4
- name: Meterian Scanner
uses: MeterianHQ/[email protected]
env:
METERIAN_API_TOKEN: ${{ secrets.METERIAN_API_TOKEN }}
with:
cli_args: "--report-sarif=report.sarif"
oss: true
- uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: report.sarif
15 changes: 6 additions & 9 deletions .github/workflows/mvn-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: xembly/workflow-manager@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
run: clean, cancel
verbose: false
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
python-version: "3.13.0"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -32,11 +29,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
java-version: 17
cache: "maven"
server-id: ossrh
server-username: MAVEN_USERNAME
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mvn-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
java-version: 17
cache: "maven"
server-id: ossrh
server-username: MAVEN_USERNAME
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/mvn-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: xembly/workflow-manager@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
run: clean, cancel
verbose: false
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
python-version: "3.13.0"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
java-version: 17
cache: "maven"

- name: Install jars
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
Expand Down
4 changes: 2 additions & 2 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
<parent>
<groupId>com.arcadedb</groupId>
<artifactId>arcadedb-parent</artifactId>
<version>24.8.1-SNAPSHOT</version>
<version>24.11.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<jline.version>3.26.3</jline.version>
<jline.version>3.27.1</jline.version>
</properties>

<artifactId>arcadedb-console</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@
import com.arcadedb.server.TestServerHelper;
import com.arcadedb.utility.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.*;
import java.time.*;
import java.util.*;
import java.util.concurrent.atomic.*;
import java.io.File;
import java.io.PrintStream;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;

/**
* Issue https://github.com/ArcadeData/arcadedb/issues/1233
Expand Down Expand Up @@ -153,16 +158,16 @@ public void testWhereAfterAsyncInsert() {
System.out.println();

// insert TOTAL_ORDERS orders
Assertions.assertEquals(insertOrders(database, TOTAL_ORDERS).get("totalRows"), TOTAL_ORDERS);
assertThat(TOTAL_ORDERS).isEqualTo(insertOrders(database, TOTAL_ORDERS).get("totalRows"));

// retrieve next eligible, it should return order id = 1
Assertions.assertEquals(retrieveNextEligibleOrder(database), 1);
assertThat(retrieveNextEligibleOrder(database)).isEqualTo(1);

// update order 1 to ERROR
updateOrderAsync(database, 1, "ERROR", LocalDateTime.now(), LocalDateTime.now().plusMinutes(5), "cs2minipds-test");

// retrieve next eligible, it should return order id = 2
Assertions.assertEquals(retrieveNextEligibleOrder(database), 2);
assertThat(retrieveNextEligibleOrder(database)).isEqualTo(2);
database.async().waitCompletion();

// re-submit order
Expand All @@ -171,7 +176,7 @@ public void testWhereAfterAsyncInsert() {

// retrieve correct order by id
try (ResultSet resultSet = database.query("sql", "select status from Order where id = 1")) {
Assertions.assertEquals(resultSet.next().getProperty("status"), "PENDING");
assertThat(resultSet.next().<String>getProperty("status")).isEqualTo("PENDING");
}

try (ResultSet resultSet = database.query("sql", "SELECT FROM Order WHERE status = 'PENDING' ORDER BY id ASC")) {
Expand All @@ -183,7 +188,7 @@ public void testWhereAfterAsyncInsert() {

// retrieve next eligible, it should return order id = 1
try {
Assertions.assertEquals(1, retrieveNextEligibleOrder(database));
assertThat(retrieveNextEligibleOrder(database)).isEqualTo(1);
} finally {
arcadeDBServer.stop();
}
Expand Down Expand Up @@ -269,7 +274,7 @@ private int retrieveNextEligibleOrder(Database database) {
System.out.println("retrieve result = " + result.toJSON());
return result.getProperty("id");
} else {
Assertions.fail("no orders found");
fail("no orders found");
return 0;
}
}
Expand All @@ -289,10 +294,10 @@ record = indexCursor.next().getRecord().asDocument(true).modify();
System.out.println("modified record = " + record);
record.save();
} else {
Assertions.fail("could not find order id = " + orderId);
fail("could not find order id = " + orderId);
}
if (!database.async().waitCompletion(3000)) {
Assertions.fail("timeout expired before order update completion");
fail("timeout expired before order update completion");
}
return updateCount.get();
}
Expand All @@ -309,7 +314,7 @@ private MutableDocument resubmitOrder(Database database, int orderId) {
}
});
} catch (Exception e) {
Assertions.fail();
fail("");
}
return record[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
import com.arcadedb.server.TestServerHelper;
import com.arcadedb.server.security.ServerSecurity;
import com.arcadedb.utility.FileUtils;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -53,6 +54,8 @@
import java.util.concurrent.atomic.*;

import static com.arcadedb.server.StaticBaseServerTest.DEFAULT_PASSWORD_FOR_TESTS;
import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;

/**
* From Discussion https://github.com/ArcadeData/arcadedb/discussions/1129#discussioncomment-6226545
Expand Down Expand Up @@ -165,7 +168,7 @@ public void testBulkAsyncInsertProductsUsingSQL() {

dtProducts.setBucketSelectionStrategy(new ThreadBucketSelectionStrategy());

Assertions.assertEquals(PARALLEL_LEVEL, dtProducts.getBuckets(false).size());
assertThat(dtProducts.getBuckets(false).size()).isEqualTo(PARALLEL_LEVEL);
});
}
}
Expand Down Expand Up @@ -242,7 +245,7 @@ public void testBulkAsyncInsertProductsUsingAPI() {
//dtProducts.setBucketSelectionStrategy(new ThreadBucketSelectionStrategy());
dtProducts.setBucketSelectionStrategy(new PartitionedBucketSelectionStrategy(List.of("name")));

Assertions.assertEquals(PARALLEL_LEVEL, dtProducts.getBuckets(false).size());
assertThat(dtProducts.getBuckets(false).size()).isEqualTo(PARALLEL_LEVEL);
});
}
}
Expand Down Expand Up @@ -354,7 +357,7 @@ public void testOrderByAfterDeleteInsert() {
try (ResultSet resultSet = database.command("sql",
"insert into Product set name = ?, type = ?, start = ?, stop = ?, v = ? return @rid", arcadeDBServer.getConfiguration(),
p.fileName, p.fileType, p.getStartValidity(), p.getStopValidity(), p.getVersion())) {
Assertions.assertTrue(resultSet.hasNext());
assertThat(resultSet.hasNext()).isTrue();
Result result = resultSet.next();
rid = result.getProperty("@rid").toString();
}
Expand All @@ -367,29 +370,29 @@ public void testOrderByAfterDeleteInsert() {
orders.add(new CandidateOrder("SIR1LRM-7.1", rid, start, stop, "cs2minipds-test", "PENDING"));
}
JSONObject insertResult = insertOrdersAsync(database, orders);
Assertions.assertEquals(insertResult.getInt("totalRows"), TOTAL);
assertThat(TOTAL).isEqualTo(insertResult.getInt("totalRows"));
int firstOrderId = 1;
int lastOrderId = TOTAL;
try (ResultSet resultSet = database.query("sql", "select from Order order by id")) {
Assertions.assertTrue(resultSet.hasNext());
assertThat(resultSet.hasNext()).isTrue();
}
String DELETE_ORDERS = "DELETE FROM Order WHERE id >= ? AND id <= ?";
try (ResultSet resultSet = database.command("sql", DELETE_ORDERS, firstOrderId, lastOrderId)) {
Assertions.assertEquals(TOTAL, (Long) resultSet.next().getProperty("count"));
assertThat((Long) resultSet.next().getProperty("count")).isEqualTo(TOTAL);
}
try (ResultSet resultSet = database.query("sql", "select from Order order by id")) {
Assertions.assertFalse(resultSet.hasNext());
assertThat(resultSet.hasNext()).isFalse();
}
insertResult = insertOrdersAsync(database, orders);
Assertions.assertEquals(TOTAL, insertResult.getInt("totalRows"));
assertThat(insertResult.getInt("totalRows")).isEqualTo(TOTAL);
try (ResultSet resultSet = database.query("sql", "select from Order")) {
Assertions.assertTrue(resultSet.hasNext());
assertThat(resultSet.hasNext()).isTrue();
}
try (ResultSet resultSet = database.query("sql", "select from Order order by processor")) {
Assertions.assertTrue(resultSet.hasNext());
assertThat(resultSet.hasNext()).isTrue();
}
try (ResultSet resultSet = database.query("sql", "select from Order order by id")) {
Assertions.assertTrue(resultSet.hasNext());
assertThat(resultSet.hasNext()).isTrue();
} finally {
arcadeDBServer.stop();
FileUtils.deleteRecursively(new File(arcadeDBServer.getRootPath() + File.separator + "config"));
Expand All @@ -398,25 +401,25 @@ public void testOrderByAfterDeleteInsert() {

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

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

Assertions.assertEquals(okCount.get(), N);
Assertions.assertEquals(errCount.get(), 0);
Assertions.assertEquals(txErrorCounter.get(), 0);
assertThat(N).isEqualTo(okCount.get());
assertThat(errCount.get()).isEqualTo(0);
assertThat(txErrorCounter.get()).isEqualTo(0);
try (ResultSet resultSet = database.query("sql", "SELECT count(*) as total FROM Product")) {
Result result = resultSet.next();
Assertions.assertEquals((Long) result.getProperty("total"), N);
assertThat(N).isEqualTo((Long) result.getProperty("total"));
Console console = new Console();
String URL = "remote:localhost/" + DATABASE_NAME + " " + userName + " " + password;
Assertions.assertTrue(console.parse("connect " + URL));
assertThat(console.parse("connect " + URL)).isTrue();
final StringBuilder buffer = new StringBuilder();
console.setOutput(output -> buffer.append(output));
Assertions.assertTrue(console.parse("select count(*) from Product"));
assertThat(console.parse("select count(*) from Product")).isTrue();
String[] lines = buffer.toString().split("\\r?\\n|\\r");
int count = Integer.parseInt(lines[4].split("\\|")[2].trim());
Assertions.assertEquals(N, count);
assertThat(count).isEqualTo(N);
} catch (IOException e) {
System.out.println(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,27 @@
import com.arcadedb.server.TestServerHelper;
import com.arcadedb.utility.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.*;

import static org.assertj.core.api.Assertions.assertThat;

public class ConsoleBatchTest {
@Test
public void batchMode() throws IOException {
Console.execute(new String[] { "-b", "create database console; create vertex type ConsoleOnlyVertex;" });
final Database db = new DatabaseFactory("./target/databases/console").open();
Assertions.assertTrue(db.getSchema().existsType("ConsoleOnlyVertex"));
assertThat(db.getSchema().existsType("ConsoleOnlyVertex")).isTrue();
db.drop();
}

@Test
public void interactiveMode() throws IOException {
Console.execute(new String[] { "create database console; create vertex type ConsoleOnlyVertex;exit" });
final Database db = new DatabaseFactory("./target/databases/console").open();
Assertions.assertTrue(db.getSchema().existsType("ConsoleOnlyVertex"));
assertThat(db.getSchema().existsType("ConsoleOnlyVertex")).isTrue();
db.drop();
}

Expand All @@ -52,7 +53,7 @@ public void swallowSettings() throws IOException {
FileUtils.deleteRecursively(new File("./console"));
Console.execute(new String[] { "-Darcadedb.server.databaseDirectory=.", "create database console; create vertex type ConsoleOnlyVertex;exit;" });
final Database db = new DatabaseFactory("./console").open();
Assertions.assertTrue(db.getSchema().existsType("ConsoleOnlyVertex"));
assertThat(db.getSchema().existsType("ConsoleOnlyVertex")).isTrue();
db.drop();
GlobalConfiguration.resetAll();
}
Expand Down
Loading

0 comments on commit e0483e5

Please sign in to comment.