Skip to content

Commit

Permalink
Unmark TypeSystem as experimental (#1376)
Browse files Browse the repository at this point in the history
The `TypeSystem` has been available for a significant time. This update removes the experimental status from it.
  • Loading branch information
injectives authored Feb 15, 2023
1 parent 7d0e75c commit 6dd7c0c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 32 deletions.
2 changes: 2 additions & 0 deletions driver/src/main/java/org/neo4j/driver/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ default AsyncSession asyncSession(SessionConfig sessionConfig) {
* The types supported on a particular server a session is connected against might not contain all of the types defined here.
*
* @return type system used by this query runner for classifying values
* @deprecated superseded by {@link TypeSystem#getDefault()}
*/
@Experimental
@Deprecated
TypeSystem defaultTypeSystem();

/**
Expand Down
3 changes: 0 additions & 3 deletions driver/src/main/java/org/neo4j/driver/Value.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.neo4j.driver.types.Relationship;
import org.neo4j.driver.types.Type;
import org.neo4j.driver.types.TypeSystem;
import org.neo4j.driver.util.Experimental;
import org.neo4j.driver.util.Immutable;

/**
Expand Down Expand Up @@ -140,7 +139,6 @@ public interface Value extends MapAccessor, MapAccessorWithDefaultValue {
Value get(int index);

/** @return The type of this value as defined in the Neo4j type system */
@Experimental
Type type();

/**
Expand All @@ -149,7 +147,6 @@ public interface Value extends MapAccessor, MapAccessorWithDefaultValue {
* @param type the given type
* @return type.isTypeOf( this )
*/
@Experimental
boolean hasType(Type type);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public CompletionStage<Void> closeAsync() {
return completedWithNull();
}

@Deprecated
@Override
public final TypeSystem defaultTypeSystem() {
return InternalTypeSystem.TYPE_SYSTEM;
Expand Down
2 changes: 0 additions & 2 deletions driver/src/main/java/org/neo4j/driver/types/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
package org.neo4j.driver.types;

import org.neo4j.driver.Value;
import org.neo4j.driver.util.Experimental;
import org.neo4j.driver.util.Immutable;

/**
* The type of a {@link Value} as defined by the Cypher language
* @since 1.0
*/
@Immutable
@Experimental
public interface Type {
/**
* @return the name of the Cypher type (as defined by Cypher)
Expand Down
2 changes: 0 additions & 2 deletions driver/src/main/java/org/neo4j/driver/types/TypeSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@

import static org.neo4j.driver.internal.types.InternalTypeSystem.TYPE_SYSTEM;

import org.neo4j.driver.util.Experimental;
import org.neo4j.driver.util.Immutable;

/**
* A listing of all database types this driver can handle.
* @since 1.0
*/
@Immutable
@Experimental
public interface TypeSystem {
/**
* Returns an instance of type system.
Expand Down
41 changes: 21 additions & 20 deletions driver/src/test/java/org/neo4j/driver/integration/ParametersIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static org.neo4j.driver.internal.util.ValueFactory.emptyNodeValue;
import static org.neo4j.driver.internal.util.ValueFactory.emptyRelationshipValue;
import static org.neo4j.driver.internal.util.ValueFactory.filledPathValue;
import static org.neo4j.driver.types.TypeSystem.getDefault;

import java.io.IOException;
import java.util.HashMap;
Expand Down Expand Up @@ -67,7 +68,7 @@ void shouldBeAbleToSetAndReturnBooleanProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().BOOLEAN()), equalTo(true));
assertThat(value.hasType(getDefault().BOOLEAN()), equalTo(true));
assertThat(value.asBoolean(), equalTo(true));
}
}
Expand All @@ -80,7 +81,7 @@ void shouldBeAbleToSetAndReturnByteProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(value.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(value.asLong(), equalTo(1L));
}
}
Expand All @@ -93,7 +94,7 @@ void shouldBeAbleToSetAndReturnShortProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(value.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(value.asLong(), equalTo(1L));
}
}
Expand All @@ -106,7 +107,7 @@ void shouldBeAbleToSetAndReturnIntegerProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(value.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(value.asLong(), equalTo(1L));
}
}
Expand All @@ -119,7 +120,7 @@ void shouldBeAbleToSetAndReturnLongProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(value.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(value.asLong(), equalTo(1L));
}
}
Expand All @@ -132,7 +133,7 @@ void shouldBeAbleToSetAndReturnDoubleProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().FLOAT()), equalTo(true));
assertThat(value.hasType(getDefault().FLOAT()), equalTo(true));
assertThat(value.asDouble(), equalTo(6.28));
}
}
Expand Down Expand Up @@ -164,10 +165,10 @@ void shouldBeAbleToSetAndReturnBooleanArrayProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().LIST()), equalTo(true));
assertThat(value.hasType(getDefault().LIST()), equalTo(true));
assertThat(value.size(), equalTo(3));
for (Value item : value.asList(ofValue())) {
assertThat(item.hasType(session.typeSystem().BOOLEAN()), equalTo(true));
assertThat(item.hasType(getDefault().BOOLEAN()), equalTo(true));
assertThat(item.asBoolean(), equalTo(true));
}
}
Expand All @@ -182,10 +183,10 @@ void shouldBeAbleToSetAndReturnIntegerArrayProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().LIST()), equalTo(true));
assertThat(value.hasType(getDefault().LIST()), equalTo(true));
assertThat(value.size(), equalTo(3));
for (Value item : value.asList(ofValue())) {
assertThat(item.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(item.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(item.asLong(), equalTo(42L));
}
}
Expand All @@ -200,10 +201,10 @@ void shouldBeAbleToSetAndReturnDoubleArrayProperty() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().LIST()), equalTo(true));
assertThat(value.hasType(getDefault().LIST()), equalTo(true));
assertThat(value.size(), equalTo(3));
for (Value item : value.asList(ofValue())) {
assertThat(item.hasType(session.typeSystem().FLOAT()), equalTo(true));
assertThat(item.hasType(getDefault().FLOAT()), equalTo(true));
assertThat(item.asDouble(), equalTo(6.28));
}
}
Expand All @@ -223,10 +224,10 @@ private static void testStringArrayContaining(String str) {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().LIST()), equalTo(true));
assertThat(value.hasType(getDefault().LIST()), equalTo(true));
assertThat(value.size(), equalTo(3));
for (Value item : value.asList(ofValue())) {
assertThat(item.hasType(session.typeSystem().STRING()), equalTo(true));
assertThat(item.hasType(getDefault().STRING()), equalTo(true));
assertThat(item.asString(), equalTo(str));
}
}
Expand Down Expand Up @@ -262,7 +263,7 @@ void shouldBeAbleToSetAndReturnBooleanPropertyWithinMap() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().BOOLEAN()), equalTo(true));
assertThat(value.hasType(getDefault().BOOLEAN()), equalTo(true));
assertThat(value.asBoolean(), equalTo(true));
}
}
Expand All @@ -276,7 +277,7 @@ void shouldBeAbleToSetAndReturnIntegerPropertyWithinMap() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().INTEGER()), equalTo(true));
assertThat(value.hasType(getDefault().INTEGER()), equalTo(true));
assertThat(value.asLong(), equalTo(42L));
}
}
Expand All @@ -290,7 +291,7 @@ void shouldBeAbleToSetAndReturnDoublePropertyWithinMap() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().FLOAT()), equalTo(true));
assertThat(value.hasType(getDefault().FLOAT()), equalTo(true));
assertThat(value.asDouble(), equalTo(6.28));
}
}
Expand All @@ -304,7 +305,7 @@ void shouldBeAbleToSetAndReturnStringPropertyWithinMap() {
// Then
for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().STRING()), equalTo(true));
assertThat(value.hasType(getDefault().STRING()), equalTo(true));
assertThat(value.asString(), equalTo("Mjölnir"));
}
}
Expand Down Expand Up @@ -397,7 +398,7 @@ private static void testBytesProperty(byte[] array) {

for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().BYTES()), equalTo(true));
assertThat(value.hasType(getDefault().BYTES()), equalTo(true));
assertThat(value.asByteArray(), equalTo(array));
}
}
Expand All @@ -407,7 +408,7 @@ private static void testStringProperty(String string) {

for (Record record : result.list()) {
Value value = record.get("a.value");
assertThat(value.hasType(session.typeSystem().STRING()), equalTo(true));
assertThat(value.hasType(getDefault().STRING()), equalTo(true));
assertThat(value.asString(), equalTo(string));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.neo4j.driver.Session;
import org.neo4j.driver.internal.BoltServerAddress;
import org.neo4j.driver.testutil.CertificateUtil.CertificateKeyPair;
import org.neo4j.driver.types.TypeSystem;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Neo4jContainer;
Expand Down Expand Up @@ -149,10 +148,6 @@ public Driver driver() {
return driver;
}

public TypeSystem typeSystem() {
return driver.defaultTypeSystem();
}

public void deleteAndStartNeo4j(Map<String, String> config) {
Map<String, String> updatedConfig = new HashMap<>(defaultConfig);
updatedConfig.putAll(config);
Expand Down

0 comments on commit 6dd7c0c

Please sign in to comment.