Skip to content

Commit

Permalink
Merge pull request #307 from eclipse-jnosql/activate-tck
Browse files Browse the repository at this point in the history
Active TCK to other oracle nosql
  • Loading branch information
otaviojava authored Jan 12, 2025
2 parents 4907a68 + 01c2b94 commit e388b87
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ protected void condition(CriteriaCondition condition, StringBuilder query, List<
case GREATER_EQUALS_THAN:
predicate(query, " >= ", document, params);
return;
case LIKE:
/* case LIKE:
predicate(query, " LIKE ", document, params);
return;
return;*/
case NOT:
query.append(" NOT ");
condition(document.get(CriteriaCondition.class), query, params, ids);
Expand All @@ -88,13 +88,12 @@ protected void condition(CriteriaCondition condition, StringBuilder query, List<
}

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

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

query.append(name).append(" ? AND ? ");
query.append(name).append(" BETWEEN ? AND ? ");
FieldValue fieldValue = FieldValueConverter.INSTANCE.of(values.get(ORIGIN));
FieldValue fieldValue2 = FieldValueConverter.INSTANCE.of(values.get(1));
params.add(fieldValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void delete(DeleteQuery query) {
}
}
if (!oracleQuery.hasOnlyIds()) {
LOGGER.finest("Executing delete query at Oracle NoSQL: " +oracleQuery.query());
LOGGER.finest("Executing delete query at Oracle NoSQL: " + oracleQuery.query());
var prepReq = new PrepareRequest().setStatement(oracleQuery.query());
var prepRes = serviceHandle.prepare(prepReq);
PreparedStatement preparedStatement = prepRes.getPreparedStatement();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
* Alessandro Moscatelli
* Maximillian Arruda
*/
package org.eclipse.jnosql.databases.oracle.tck;

import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.nosql.Template;
import jakarta.nosql.tck.TemplateSupplier;
import org.eclipse.jnosql.databases.oracle.communication.Database;
import org.eclipse.jnosql.databases.oracle.communication.OracleNoSQLConfigurations;
import org.eclipse.jnosql.mapping.core.config.MappingConfigurations;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;


public class OracleNoSQLTemplateSupplier implements TemplateSupplier {

static {
System.setProperty(OracleNoSQLConfigurations.HOST.get(), Database.INSTANCE.host());
System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), "jakartanosqltck");
SeContainerInitializer.newInstance().initialize();
}

@Override
public Template get() {
return CDI.current().select(DocumentTemplate.class).get();
}
}
21 changes: 21 additions & 0 deletions jnosql-oracle-nosql/src/test/resources/META-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ and Apache License v2.0 which accompanies this distribution.
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
~
~ You may elect to redistribute this code under either of these licenses.
~
~ Contributors:
~
~ Otavio Santana
-->

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.jnosql.databases.oracle.tck.OracleNoSQLTemplateSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public enum KeyValueDatabase implements Supplier<RedisBucketManagerFactory> {
redis.start();
}

public String host() {
return redis.getHost();
}

public String port() {
return String.valueOf(redis.getFirstMappedPort());
}

@Override
public RedisBucketManagerFactory get() {
RedisConfiguration configuration = new RedisConfiguration();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
* Alessandro Moscatelli
* Maximillian Arruda
*/
package org.eclipse.jnosql.databases.redis.tck;

import jakarta.enterprise.inject.se.SeContainerInitializer;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.nosql.Template;
import jakarta.nosql.tck.TemplateSupplier;
import org.eclipse.jnosql.databases.redis.communication.KeyValueDatabase;
import org.eclipse.jnosql.databases.redis.communication.RedisConfigurations;
import org.eclipse.jnosql.mapping.core.config.MappingConfigurations;


public class RedisDBTemplateSupplier implements TemplateSupplier {

static {
System.setProperty(RedisConfigurations.HOST.get(), KeyValueDatabase.INSTANCE.host());
System.setProperty(RedisConfigurations.PORT.get(), KeyValueDatabase.INSTANCE.port());
System.setProperty(MappingConfigurations.KEY_VALUE_DATABASE.get(), "jakarta-nosql-tck");
SeContainerInitializer.newInstance().initialize();
}

@Override
public Template get() {
return CDI.current().select(Template.class).get();
}
}
21 changes: 21 additions & 0 deletions jnosql-redis/src/test/resources/META-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ and Apache License v2.0 which accompanies this distribution.
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
~
~ You may elect to redistribute this code under either of these licenses.
~
~ Contributors:
~
~ Otavio Santana
-->

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.jnosql.databases.redis.tck.RedisDBTemplateSupplier

0 comments on commit e388b87

Please sign in to comment.