Skip to content

Commit

Permalink
Update tck driver API
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jun 21, 2022
1 parent 4e2e1c7 commit e995c79
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Expand Up @@ -23,12 +23,14 @@
import jakarta.nosql.column.ColumnFamilyManager;
import jakarta.nosql.column.ColumnQuery;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;

import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand All @@ -42,6 +44,11 @@

public class ColumnFamilyManagerTest {

@BeforeEach
public void setUp() {
Module module = ColumnFamilyManagerTest.class.getModule();
module.addUses(ColumnFamilyManagerSupplier.class);
}
@ParameterizedTest
@ColumnSource("column.properties")
public void shouldInsert(ColumnArgument argument) {
Expand Down Expand Up @@ -307,7 +314,9 @@ private ColumnFamilyManager getManager(ColumnArgument argument) {
}

private ColumnFamilyManager getManager() {
final ColumnFamilyManagerSupplier supplier = ServiceLoaderProvider.get(ColumnFamilyManagerSupplier.class);
final ColumnFamilyManagerSupplier supplier = ServiceLoaderProvider
.get(ColumnFamilyManagerSupplier.class,
()-> ServiceLoader.load(ColumnFamilyManagerSupplier.class));
return supplier.get();
}

Expand Down
Expand Up @@ -23,12 +23,14 @@
import jakarta.nosql.document.DocumentEntity;
import jakarta.nosql.document.DocumentQuery;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;

import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand All @@ -42,6 +44,11 @@

public class DocumentCollectionManagerTest {

@BeforeEach
public void setUp() {
Module module = DocumentCollectionManagerTest.class.getModule();
module.addUses(DocumentCollectionManagerSupplier.class);
}
@ParameterizedTest
@DocumentSource("document.properties")
public void shouldInsert(DocumentArgument argument) {
Expand Down Expand Up @@ -308,7 +315,9 @@ private DocumentCollectionManager getManager(DocumentArgument argument) {
}

private DocumentCollectionManager getManager() {
final DocumentCollectionManagerSupplier supplier = ServiceLoaderProvider.get(DocumentCollectionManagerSupplier.class);
final DocumentCollectionManagerSupplier supplier = ServiceLoaderProvider
.get(DocumentCollectionManagerSupplier.class,
()-> ServiceLoader.load(DocumentCollectionManagerSupplier.class));
return supplier.get();
}

Expand Down
Expand Up @@ -22,11 +22,13 @@
import jakarta.nosql.keyvalue.KeyValueEntity;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

Expand All @@ -47,6 +49,11 @@ public class BucketManagerTest {
private KeyValueEntity keyValueSoro = KeyValueEntity.of("soro", Value.of(userSoro));


@BeforeEach
public void setUp() {
Module module = BucketManagerTest.class.getModule();
module.addUses(BucketManagerSupplier.class);
}
@Test
public void shouldPutValue() {
final BucketManager manager = getBucketManager();
Expand Down Expand Up @@ -120,13 +127,16 @@ public void remove() {


private BucketManager getBucketManager() {
final BucketManagerSupplier bucketManagerSupplier = ServiceLoaderProvider.get(BucketManagerSupplier.class);
final BucketManagerSupplier bucketManagerSupplier = ServiceLoaderProvider
.get(BucketManagerSupplier.class,
()-> ServiceLoader.load(BucketManagerSupplier.class));
return bucketManagerSupplier.get();
}

private Optional<BucketManagerSupplier> getSupplier() {
return ServiceLoaderProvider
.getSupplierStream(BucketManagerSupplier.class)
.getSupplierStream(BucketManagerSupplier.class,
()-> ServiceLoader.load(BucketManagerSupplier.class))
.map(BucketManagerSupplier.class::cast)
.findFirst();
}
Expand Down

0 comments on commit e995c79

Please sign in to comment.