Skip to content

Commit e388b87

Browse files
authored
Merge pull request #307 from eclipse-jnosql/activate-tck
Active TCK to other oracle nosql
2 parents 4907a68 + 01c2b94 commit e388b87

File tree

9 files changed

+138
-5
lines changed

9 files changed

+138
-5
lines changed

jnosql-oracle-nosql/src/main/java/org/eclipse/jnosql/databases/oracle/communication/AbstractQueryBuilder.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ protected void condition(CriteriaCondition condition, StringBuilder query, List<
6464
case GREATER_EQUALS_THAN:
6565
predicate(query, " >= ", document, params);
6666
return;
67-
case LIKE:
67+
/* case LIKE:
6868
predicate(query, " LIKE ", document, params);
69-
return;
69+
return;*/
7070
case NOT:
7171
query.append(" NOT ");
7272
condition(document.get(CriteriaCondition.class), query, params, ids);
@@ -88,13 +88,12 @@ protected void condition(CriteriaCondition condition, StringBuilder query, List<
8888
}
8989

9090
protected void predicateBetween(StringBuilder query,List<FieldValue> params, Element document) {
91-
query.append(" BETWEEN ");
9291
String name = identifierOf(document.name());
9392

9493
List<Object> values = new ArrayList<>();
9594
((Iterable<?>) document.get()).forEach(values::add);
9695

97-
query.append(name).append(" ? AND ? ");
96+
query.append(name).append(" BETWEEN ? AND ? ");
9897
FieldValue fieldValue = FieldValueConverter.INSTANCE.of(values.get(ORIGIN));
9998
FieldValue fieldValue2 = FieldValueConverter.INSTANCE.of(values.get(1));
10099
params.add(fieldValue);

jnosql-oracle-nosql/src/main/java/org/eclipse/jnosql/databases/oracle/communication/DefaultOracleNoSQLDocumentManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void delete(DeleteQuery query) {
143143
}
144144
}
145145
if (!oracleQuery.hasOnlyIds()) {
146-
LOGGER.finest("Executing delete query at Oracle NoSQL: " +oracleQuery.query());
146+
LOGGER.finest("Executing delete query at Oracle NoSQL: " + oracleQuery.query());
147147
var prepReq = new PrepareRequest().setStatement(oracleQuery.query());
148148
var prepRes = serviceHandle.prepare(prepReq);
149149
PreparedStatement preparedStatement = prepRes.getPreparedStatement();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to the Eclipse Foundation
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+
* Alessandro Moscatelli
15+
* Maximillian Arruda
16+
*/
17+
package org.eclipse.jnosql.databases.oracle.tck;
18+
19+
import jakarta.enterprise.inject.se.SeContainerInitializer;
20+
import jakarta.enterprise.inject.spi.CDI;
21+
import jakarta.nosql.Template;
22+
import jakarta.nosql.tck.TemplateSupplier;
23+
import org.eclipse.jnosql.databases.oracle.communication.Database;
24+
import org.eclipse.jnosql.databases.oracle.communication.OracleNoSQLConfigurations;
25+
import org.eclipse.jnosql.mapping.core.config.MappingConfigurations;
26+
import org.eclipse.jnosql.mapping.document.DocumentTemplate;
27+
28+
29+
public class OracleNoSQLTemplateSupplier implements TemplateSupplier {
30+
31+
static {
32+
System.setProperty(OracleNoSQLConfigurations.HOST.get(), Database.INSTANCE.host());
33+
System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), "jakartanosqltck");
34+
SeContainerInitializer.newInstance().initialize();
35+
}
36+
37+
@Override
38+
public Template get() {
39+
return CDI.current().select(DocumentTemplate.class).get();
40+
}
41+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
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+
-->
15+
16+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
17+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
19+
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
20+
bean-discovery-mode="annotated">
21+
</beans>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.jnosql.databases.oracle.tck.OracleNoSQLTemplateSupplier

jnosql-redis/src/test/java/org/eclipse/jnosql/databases/redis/communication/KeyValueDatabase.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public enum KeyValueDatabase implements Supplier<RedisBucketManagerFactory> {
3535
redis.start();
3636
}
3737

38+
public String host() {
39+
return redis.getHost();
40+
}
41+
42+
public String port() {
43+
return String.valueOf(redis.getFirstMappedPort());
44+
}
45+
3846
@Override
3947
public RedisBucketManagerFactory get() {
4048
RedisConfiguration configuration = new RedisConfiguration();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to the Eclipse Foundation
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+
* Alessandro Moscatelli
15+
* Maximillian Arruda
16+
*/
17+
package org.eclipse.jnosql.databases.redis.tck;
18+
19+
import jakarta.enterprise.inject.se.SeContainerInitializer;
20+
import jakarta.enterprise.inject.spi.CDI;
21+
import jakarta.nosql.Template;
22+
import jakarta.nosql.tck.TemplateSupplier;
23+
import org.eclipse.jnosql.databases.redis.communication.KeyValueDatabase;
24+
import org.eclipse.jnosql.databases.redis.communication.RedisConfigurations;
25+
import org.eclipse.jnosql.mapping.core.config.MappingConfigurations;
26+
27+
28+
public class RedisDBTemplateSupplier implements TemplateSupplier {
29+
30+
static {
31+
System.setProperty(RedisConfigurations.HOST.get(), KeyValueDatabase.INSTANCE.host());
32+
System.setProperty(RedisConfigurations.PORT.get(), KeyValueDatabase.INSTANCE.port());
33+
System.setProperty(MappingConfigurations.KEY_VALUE_DATABASE.get(), "jakarta-nosql-tck");
34+
SeContainerInitializer.newInstance().initialize();
35+
}
36+
37+
@Override
38+
public Template get() {
39+
return CDI.current().select(Template.class).get();
40+
}
41+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
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+
-->
15+
16+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
17+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
19+
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
20+
bean-discovery-mode="annotated">
21+
</beans>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.eclipse.jnosql.databases.redis.tck.RedisDBTemplateSupplier

0 commit comments

Comments
 (0)