Skip to content

Commit 663e5aa

Browse files
committed
removes entity on column argument
1 parent 9682fd2 commit 663e5aa

File tree

4 files changed

+67
-24
lines changed

4 files changed

+67
-24
lines changed

cassandra-driver/src/test/java/jakarta/nosql/tck/communication/driver/column/ColumnArgument.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*
2+
* Copyright (c) 2020 Otávio Santana and others
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
115
package jakarta.nosql.tck.communication.driver.column;
216

317
import java.util.Collections;
@@ -7,32 +21,25 @@ public final class ColumnArgument {
721

822
static final ColumnArgument EMPTY = new ColumnArgument();
923

10-
private final String entity;
11-
1224
private final List<String> query;
1325

1426
private final String idName;
1527

1628
private final boolean empty;
1729

18-
ColumnArgument(String entity, List<String> query, String idName) {
19-
this.entity = entity;
30+
ColumnArgument(List<String> query, String idName) {
2031
this.query = query;
2132
this.idName = idName;
2233
this.empty = true;
2334
}
35+
2436
ColumnArgument() {
25-
this.entity = null;
2637
this.query = null;
2738
this.idName = null;
2839
this.empty = false;
2940
}
3041

3142

32-
public String getEntity() {
33-
return entity;
34-
}
35-
3643
public List<String> getQuery() {
3744
if (query == null) {
3845
return Collections.emptyList();
@@ -51,9 +58,9 @@ public boolean isEmpty() {
5158
@Override
5259
public String toString() {
5360
return "ColumnArgument{" +
54-
"entity='" + entity + '\'' +
55-
", query=" + query +
61+
"query=" + query +
5662
", idName='" + idName + '\'' +
63+
", empty=" + empty +
5764
'}';
5865
}
5966
}

cassandra-driver/src/test/java/jakarta/nosql/tck/communication/driver/column/ColumnArgumentProvider.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*
2+
* Copyright (c) 2020 Otávio Santana and others
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
115
package jakarta.nosql.tck.communication.driver.column;
216

317
import org.eclipse.jnosql.diana.driver.ConfigurationReader;
@@ -31,13 +45,12 @@ public Stream<? extends Arguments> provideArguments(ExtensionContext extensionCo
3145
if (map.isEmpty()) {
3246
return Stream.of(Arguments.of(ColumnArgument.EMPTY));
3347
}
34-
final String entity = map.get("entity");
3548
final String idName = map.get("id.name");
3649
final List<String> query = map.entrySet().stream()
3750
.filter(s -> s.getKey().startsWith("query"))
3851
.map(Map.Entry::getValue)
3952
.collect(Collectors.toList());
40-
return Stream.of(Arguments.of(new ColumnArgument(entity, query, idName)));
53+
return Stream.of(Arguments.of(new ColumnArgument(query, idName)));
4154
}
4255

4356

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
1+
/*
2+
* Copyright (c) 2020 Otávio Santana and others
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
115
package jakarta.nosql.tck.communication.driver.column;
216

17+
import jakarta.nosql.ServiceLoaderProvider;
18+
import jakarta.nosql.column.ColumnEntity;
19+
import jakarta.nosql.column.ColumnFamilyManager;
320
import org.junit.jupiter.api.Assumptions;
421
import org.junit.jupiter.params.ParameterizedTest;
522
import org.junit.jupiter.params.provider.ArgumentsSource;
623

24+
import java.util.List;
25+
import java.util.Optional;
26+
import java.util.stream.Collectors;
27+
728
import static org.junit.jupiter.api.Assertions.assertNotNull;
829
import static org.junit.jupiter.api.Assertions.assertTrue;
930

1031
public class ColumnFamilyManagerTest {
1132

1233
@ParameterizedTest
1334
@ColumnSource("column_insert.properties")
14-
public void parameterizedTest(ColumnArgument argument) {
15-
Assumptions.assumeFalse(argument.isEmpty());
16-
assertNotNull(argument);
35+
public void shouldInsert(ColumnArgument argument) {
36+
Assumptions.assumeFalse(argument.isEmpty(), "The you put the file in the resources to activate this test");
37+
ColumnFamilyManager manager = getManager();
38+
Optional<ColumnEntity> entity = argument.getQuery().stream().flatMap(manager::query)
39+
.findFirst();
40+
41+
1742
}
1843

19-
@ParameterizedTest
20-
@ColumnSource("empty")
21-
public void parameterizedTest3(ColumnArgument argument) {
22-
Assumptions.assumeFalse(argument.isEmpty(), "The you put the file in the resources to activate this test");
23-
assertNotNull(argument);
44+
private ColumnFamilyManager getManager() {
45+
final ColumnFamilyManagerSupplier supplier = ServiceLoaderProvider.get(ColumnFamilyManagerSupplier.class);
46+
return supplier.get();
2447
}
48+
2549
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
query.1=
2-
entity=people
3-
id.name=id
1+
query.1=insert person {"id": 1, "name": "Diana"}
2+
id.name=id

0 commit comments

Comments
 (0)