Skip to content

Commit

Permalink
Simplify the FacadeMethod tests and extend the transaction check to m…
Browse files Browse the repository at this point in the history
…ore facade methods.
  • Loading branch information
chrisvest committed Aug 9, 2018
1 parent 271b142 commit a9a4e09
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 1,037 deletions.
Expand Up @@ -26,93 +26,15 @@

public class NodeIndexFacadeMethods
{
private static final FacadeMethod<Index<Node>> GET = new FacadeMethod<Index<Node>>( "IndexHits<T> get( String " +
"key, Object value )" )
{
@Override
public void call( Index<Node> self )
{
self.get( "foo", "bar" );
}
};

private static final FacadeMethod<Index<Node>> QUERY_BY_KEY = new FacadeMethod<Index<Node>>( "IndexHits<T> query(" +
" String key, Object queryOrQueryObject )" )
{
@Override
public void call( Index<Node> self )
{
self.query( "foo", "bar" );
}
};

private static final FacadeMethod<Index<Node>> QUERY = new FacadeMethod<Index<Node>>( "IndexHits<T> query( Object" +
" queryOrQueryObject )" )
{
@Override
public void call( Index<Node> self )
{
self.query( "foo" );
}
};

private static final FacadeMethod<Index<Node>> ADD = new FacadeMethod<Index<Node>>( "void add( T entity, " +
"String key, Object value )" )
{
@Override
public void call( Index<Node> self )
{
self.add( null, "foo", 42 );
}
};

private static final FacadeMethod<Index<Node>> REMOVE_BY_KEY_AND_VALUE = new FacadeMethod<Index<Node>>( "void " +
"remove( T entity, String key, Object value )" )
{
@Override
public void call( Index<Node> self )
{
self.remove( null, "foo", 42 );
}
};

private static final FacadeMethod<Index<Node>> REMOVE_BY_KEY = new FacadeMethod<Index<Node>>( "void remove( T " +
"entity, String key )" )
{
@Override
public void call( Index<Node> self )
{
self.remove( null, "foo" );
}
};

private static final FacadeMethod<Index<Node>> REMOVE = new FacadeMethod<Index<Node>>( "void remove( T entity )" )
{
@Override
public void call( Index<Node> self )
{
self.remove( null );
}
};

private static final FacadeMethod<Index<Node>> DELETE = new FacadeMethod<Index<Node>>( "void delete()" )
{
@Override
public void call( Index<Node> self )
{
self.delete();
}
};

private static final FacadeMethod<Index<Node>> PUT_IF_ABSENT = new FacadeMethod<Index<Node>>( "T putIfAbsent( T " +
"entity, String key, Object value )" )
{
@Override
public void call( Index<Node> self )
{
self.putIfAbsent( null, "foo", 42 );
}
};
private static final FacadeMethod<Index<Node>> GET = new FacadeMethod<>( "IndexHits<T> get( String key, Object value )", self -> self.get( "foo", "bar" ) );
private static final FacadeMethod<Index<Node>> QUERY_BY_KEY = new FacadeMethod<>( "IndexHits<T> query( String key, Object queryOrQueryObject )", self -> self.query( "foo", "bar" ) );
private static final FacadeMethod<Index<Node>> QUERY = new FacadeMethod<>( "IndexHits<T> query( Object queryOrQueryObject )", self -> self.query( "foo" ) );
private static final FacadeMethod<Index<Node>> ADD = new FacadeMethod<>( "void add( T entity, String key, Object value )", self -> self.add( null, "foo", 42 ) );
private static final FacadeMethod<Index<Node>> REMOVE_BY_KEY_AND_VALUE = new FacadeMethod<>( "void remove( T entity, String key, Object value )", self -> self.remove( null, "foo", 42 ) );
private static final FacadeMethod<Index<Node>> REMOVE_BY_KEY = new FacadeMethod<>( "void remove( T entity, String key )", self -> self.remove( null, "foo" ) );
private static final FacadeMethod<Index<Node>> REMOVE = new FacadeMethod<>( "void remove( T entity )", self -> self.remove( null ) );
private static final FacadeMethod<Index<Node>> DELETE = new FacadeMethod<>( "void delete()", Index::delete );
private static final FacadeMethod<Index<Node>> PUT_IF_ABSENT = new FacadeMethod<>( "T putIfAbsent( T entity, String key, Object value )", self -> self.putIfAbsent( null, "foo", 42 ) );

static final Iterable<FacadeMethod<Index<Node>>> ALL_NODE_INDEX_FACADE_METHODS = unmodifiableCollection(
asList(
Expand Down
Expand Up @@ -26,126 +26,18 @@

public class RelationshipIndexFacadeMethods
{
private static final FacadeMethod<RelationshipIndex> GET_WITH_FILTER = new FacadeMethod<RelationshipIndex>(
"IndexHits<Relationship> get( String key, Object valueOrNull, Node startNodeOrNull, Node endNodeOrNull )" )
{
@Override
public void call( RelationshipIndex self )
{
self.get( "foo", 42, null, null );
}
};

private static final FacadeMethod<RelationshipIndex> QUERY_BY_KEY_WITH_FILTER = new
FacadeMethod<RelationshipIndex>( "IndexHits<Relationship> query( String key, " +
"Object queryOrQueryObjectOrNull, Node startNodeOrNull, Node endNodeOrNull )" )
{
@Override
public void call( RelationshipIndex self )
{
self.query( "foo", 42, null, null );
}
};

private static final FacadeMethod<RelationshipIndex> QUERY_WITH_FILTER = new FacadeMethod<RelationshipIndex>(
"IndexHits<Relationship> query( Object queryOrQueryObjectOrNull, Node startNodeOrNull, " +
"Node endNodeOrNull )" )
{
@Override
public void call( RelationshipIndex self )
{
self.query( 42, null, null );
}
};

private static final FacadeMethod<RelationshipIndex> GET = new FacadeMethod<RelationshipIndex>( "IndexHits<T>" +
" get( String key, Object value )" )
{
@Override
public void call( RelationshipIndex self )
{
self.get( "foo", "bar" );
}
};

private static final FacadeMethod<RelationshipIndex> QUERY_BY_KEY = new FacadeMethod<RelationshipIndex>(
"IndexHits<T> query( String key, Object queryOrQueryObject )" )
{
@Override
public void call( RelationshipIndex self )
{
self.query( "foo", "bar" );
}
};

private static final FacadeMethod<RelationshipIndex> QUERY = new FacadeMethod<RelationshipIndex>(
"IndexHits<T> query( Object queryOrQueryObject )" )
{
@Override
public void call( RelationshipIndex self )
{
self.query( "foo" );
}
};

private static final FacadeMethod<RelationshipIndex> ADD = new FacadeMethod<RelationshipIndex>( "void add( T " +
"entity, String key, Object value )" )
{
@Override
public void call( RelationshipIndex self )
{
self.add( null, "foo", 42 );
}
};

private static final FacadeMethod<RelationshipIndex> REMOVE_BY_KEY_AND_VALUE = new
FacadeMethod<RelationshipIndex>( "void remove( T entity, String key, Object value )" )
{
@Override
public void call( RelationshipIndex self )
{
self.remove( null, "foo", 42 );
}
};

private static final FacadeMethod<RelationshipIndex> REMOVE_BY_KEY = new FacadeMethod<RelationshipIndex>(
"void remove( T entity, String key )" )
{
@Override
public void call( RelationshipIndex self )
{
self.remove( null, "foo" );
}
};

private static final FacadeMethod<RelationshipIndex> REMOVE = new FacadeMethod<RelationshipIndex>( "void " +
"remove( T entity )" )
{
@Override
public void call( RelationshipIndex self )
{
self.remove( null );
}
};

private static final FacadeMethod<RelationshipIndex> DELETE = new FacadeMethod<RelationshipIndex>( "void delete()" )
{
@Override
public void call( RelationshipIndex self )
{
self.delete();
}
};

private static final FacadeMethod<RelationshipIndex> PUT_IF_ABSENT = new FacadeMethod<RelationshipIndex>( "T " +
"putIfAbsent( T entity, String key, Object value )" )
{
@Override
public void call( RelationshipIndex self )
{
self.putIfAbsent( null, "foo", 42 );
}
};
private static final FacadeMethod<RelationshipIndex> GET_WITH_FILTER = new FacadeMethod<>( "IndexHits<Relationship> get( String key, Object valueOrNull, Node startNodeOrNull, Node endNodeOrNull )", ri -> ri.get( "foo", 42, null, null ) );
private static final FacadeMethod<RelationshipIndex> QUERY_BY_KEY_WITH_FILTER = new FacadeMethod<>( "IndexHits<Relationship> query( String key, Object queryOrQueryObjectOrNull, Node startNodeOrNull, Node endNodeOrNull )", ri -> ri.query( "foo", 42, null, null ) );
private static final FacadeMethod<RelationshipIndex> QUERY_WITH_FILTER = new FacadeMethod<>( "IndexHits<Relationship> query( Object queryOrQueryObjectOrNull, Node startNodeOrNull, Node endNodeOrNull )", ri -> ri.query( 42, null, null ) );
private static final FacadeMethod<RelationshipIndex> GET = new FacadeMethod<>( "IndexHits<T> get( String key, Object value )", ri -> ri.get( "foo", "bar" ) );
private static final FacadeMethod<RelationshipIndex> QUERY_BY_KEY = new FacadeMethod<>( "IndexHits<T> query( String key, Object queryOrQueryObject )", ri -> ri.query( "foo", "bar" ) );
private static final FacadeMethod<RelationshipIndex> QUERY = new FacadeMethod<>( "IndexHits<T> query( Object queryOrQueryObject )", ri -> ri.query( "foo" ) );
private static final FacadeMethod<RelationshipIndex> ADD = new FacadeMethod<>( "void add( T entity, String key, Object value )", ri -> ri.add( null, "foo", 42 ) );
private static final FacadeMethod<RelationshipIndex> REMOVE_BY_KEY_AND_VALUE = new FacadeMethod<>( "void remove( T entity, String key, Object value )", ri -> ri.remove( null, "foo", 42 ) );
private static final FacadeMethod<RelationshipIndex> REMOVE_BY_KEY = new FacadeMethod<>( "void remove( T entity, String key )", ri -> ri.remove( null, "foo" ) );
private static final FacadeMethod<RelationshipIndex> REMOVE = new FacadeMethod<>( "void remove( T entity )", ri -> ri.remove( null ) );
private static final FacadeMethod<RelationshipIndex> DELETE = new FacadeMethod<>( "void delete()", RelationshipIndex::delete );
private static final FacadeMethod<RelationshipIndex> PUT_IF_ABSENT = new FacadeMethod<>( "T putIfAbsent( T entity, String key, Object value )", ri -> ri.putIfAbsent( null, "foo", 42 ) );

static final Iterable<FacadeMethod<RelationshipIndex>> ALL_RELATIONSHIP_INDEX_FACADE_METHODS =
unmodifiableCollection(
Expand Down
Expand Up @@ -26,25 +26,8 @@

public class ConstraintCreatorFacadeMethods
{
private static final FacadeMethod<ConstraintCreator> UNIQUE =
new FacadeMethod<ConstraintCreator>( "ConstraintCreator unique()" )
{
@Override
public void call( ConstraintCreator self )
{
self.assertPropertyIsUnique( "property" );
}
};

private static final FacadeMethod<ConstraintCreator> CREATE =
new FacadeMethod<ConstraintCreator>( "ConstraintDefinition create()" )
{
@Override
public void call( ConstraintCreator self )
{
self.create();
}
};
private static final FacadeMethod<ConstraintCreator> UNIQUE = new FacadeMethod<>( "ConstraintCreator assertPropertyIsUnique()", self -> self.assertPropertyIsUnique( "property" ) );
private static final FacadeMethod<ConstraintCreator> CREATE = new FacadeMethod<>( "ConstraintDefinition create()", ConstraintCreator::create );

static final Iterable<FacadeMethod<ConstraintCreator>> ALL_CONSTRAINT_CREATOR_FACADE_METHODS =
unmodifiableCollection( asList(
Expand Down
Expand Up @@ -27,55 +27,11 @@

public class ConstraintDefinitionFacadeMethods
{
private static final FacadeMethod<ConstraintDefinition> GET_LABEL =
new FacadeMethod<ConstraintDefinition>( "Label getLabel()" )
{
@Override
public void call( ConstraintDefinition self )
{
self.getLabel();
}
};

private static final FacadeMethod<ConstraintDefinition> GET_RELATIONSHIP_TYPE =
new FacadeMethod<ConstraintDefinition>( "RelationshipType getRelationshipType()" )
{
@Override
public void call( ConstraintDefinition self )
{
self.getRelationshipType();
}
};

private static final FacadeMethod<ConstraintDefinition> DROP =
new FacadeMethod<ConstraintDefinition>( "void drop()" )
{
@Override
public void call( ConstraintDefinition self )
{
self.drop();
}
};

private static final FacadeMethod<ConstraintDefinition> IS_CONSTRAINT_TYPE =
new FacadeMethod<ConstraintDefinition>( "boolean isConstraintType( ConstraintType type )" )
{
@Override
public void call( ConstraintDefinition self )
{
self.isConstraintType( ConstraintType.UNIQUENESS );
}
};

private static final FacadeMethod<ConstraintDefinition> GET_PROPERTY_KEYS =
new FacadeMethod<ConstraintDefinition>( "Iterable<String> getPropertyKeys()" )
{
@Override
public void call( ConstraintDefinition self )
{
self.getPropertyKeys();
}
};
private static final FacadeMethod<ConstraintDefinition> GET_LABEL = new FacadeMethod<>( "Label getLabel()", ConstraintDefinition::getLabel );
private static final FacadeMethod<ConstraintDefinition> GET_RELATIONSHIP_TYPE = new FacadeMethod<>( "RelationshipType getRelationshipType()", ConstraintDefinition::getRelationshipType );
private static final FacadeMethod<ConstraintDefinition> DROP = new FacadeMethod<>( "void drop()", ConstraintDefinition::drop );
private static final FacadeMethod<ConstraintDefinition> IS_CONSTRAINT_TYPE = new FacadeMethod<>( "boolean isConstraintType( ConstraintType type )", self -> self.isConstraintType( ConstraintType.UNIQUENESS ) );
private static final FacadeMethod<ConstraintDefinition> GET_PROPERTY_KEYS = new FacadeMethod<>( "Iterable<String> getPropertyKeys()", ConstraintDefinition::getPropertyKeys );

static final Iterable<FacadeMethod<ConstraintDefinition>> ALL_CONSTRAINT_DEFINITION_FACADE_METHODS =
unmodifiableCollection( asList(
Expand Down

0 comments on commit a9a4e09

Please sign in to comment.