Skip to content

Commit

Permalink
chore: use @EnabledOnOs and @DisabledOnOs annotations in tests (#1862)
Browse files Browse the repository at this point in the history
  • Loading branch information
robfrank authored Dec 13, 2024
1 parent 05df16f commit d5fdbf5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
28 changes: 15 additions & 13 deletions console/src/test/java/com/arcadedb/console/ConsoleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@
import com.arcadedb.server.TestServerHelper;
import com.arcadedb.utility.FileUtils;
import org.junit.jupiter.api.AfterEach;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.io.*;
import java.text.*;
import java.util.*;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
Expand Down Expand Up @@ -68,10 +72,8 @@ public void drop() throws IOException {
}

@Test
@DisabledOnOs({ OS.WINDOWS })
public void testDropCreateWithLocalUrl() throws IOException {
if (System.getProperty("os.name").toLowerCase().contains("windows"))
return;

String localUrl = "local:/" + absoluteDBPath + "/" + DB_NAME;
assertThat(console.parse("drop database " + localUrl + "; close", false)).isTrue();
assertThat(console.parse("create database " + localUrl + "; close", false)).isTrue();
Expand Down Expand Up @@ -113,9 +115,8 @@ public void testConnect() throws IOException {
}

@Test
@DisabledOnOs({ OS.WINDOWS })
public void testLocalConnect() throws IOException {
if (System.getProperty("os.name").toLowerCase().contains("windows"))
return;
assertThat(console.parse("connect local:/" + absoluteDBPath + "/" + DB_NAME + ";info types", false)).isTrue();
}

Expand Down Expand Up @@ -204,7 +205,8 @@ public void testAllRecordTypes() throws IOException {
assertThat(console.parse("insert into D set name = 'Jay', lastname='Miner'")).isTrue();
assertThat(console.parse("insert into V set name = 'Jay', lastname='Miner'")).isTrue();
assertThat(console.parse("insert into V set name = 'Elon', lastname='Musk'")).isTrue();
assertThat(console.parse("create edge E from (select from V where name ='Jay') to (select from V where name ='Elon')")).isTrue();
assertThat(
console.parse("create edge E from (select from V where name ='Jay') to (select from V where name ='Elon')")).isTrue();

final StringBuilder buffer = new StringBuilder();
console.setOutput(output -> buffer.append(output));
Expand Down Expand Up @@ -374,7 +376,7 @@ public void testProjectionOrder() throws IOException {
assertThat(console.parse("connect " + DB_NAME)).isTrue();
assertThat(console.parse("create document type Order")).isTrue();
assertThat(console.parse(
"insert into Order set processor = 'SIR1LRM-7.1', vstart = '20220319_002624.404379', vstop = '20220319_002826.525650', status = 'PENDING'")).isTrue();
"insert into Order set processor = 'SIR1LRM-7.1', vstart = '20220319_002624.404379', vstop = '20220319_002826.525650', status = 'PENDING'")).isTrue();

{
final StringBuilder buffer = new StringBuilder();
Expand Down Expand Up @@ -469,10 +471,10 @@ public void testCustomPropertyInSchema() throws IOException {
assertThat(console.getDatabase().getSchema().getType("doc").getProperty("prop").getCustomValue("test")).isEqualTo(true);

assertThat(console.getDatabase().query("sql", "SELECT properties.custom.test[0].type() as type FROM schema:types").next()
.<String>getProperty("type")).isEqualTo(Type.BOOLEAN.name().toUpperCase());
.<String>getProperty("type")).isEqualTo(Type.BOOLEAN.name().toUpperCase());

assertThat(console.getDatabase().command("sql", "SELECT properties.custom.test[0].type() as type FROM schema:types").next()
.<String>getProperty("type")).isEqualTo(Type.BOOLEAN.name().toUpperCase());
.<String>getProperty("type")).isEqualTo(Type.BOOLEAN.name().toUpperCase());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import com.arcadedb.exception.DatabaseOperationException;
import com.arcadedb.security.SecurityManager;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
Expand Down Expand Up @@ -92,10 +95,8 @@ void testDatabaseRegistrationWithDifferentPathTypes() {
}

@Test
@EnabledOnOs(OS.WINDOWS)
void testDuplicatedDatabaseCreationWithDifferentPathTypes() {
if (!System.getProperty("os.name").toLowerCase().contains("windows"))
return;

final DatabaseFactory f1 = new DatabaseFactory("path/to/database");
final Database db = f1.create();

Expand Down

0 comments on commit d5fdbf5

Please sign in to comment.