Skip to content

Commit

Permalink
Merge pull request #6470 from Mats-SX/3.0-tck-adapt
Browse files Browse the repository at this point in the history
Adapt existing features to new format
  • Loading branch information
Mats-SX committed Mar 1, 2016
2 parents aa16a5b + 65e7047 commit 2617939
Show file tree
Hide file tree
Showing 19 changed files with 538 additions and 548 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ public Map<String,Object> getAllProperties()
@Override
public boolean equals( Object obj )
{
if ( obj == this )
{
return true;
}
if ( obj == null )
{
return false;
Expand All @@ -246,8 +250,33 @@ else if ( obj instanceof ParsedNode )
return false;
}

public static Node parsedNode(final Iterable<Label> labelNames, final Map<String, Object> properties) {
return new ParsedNode() {
@Override
public int hashCode()
{
int hash = 3;
hash = hash * 23 + getLabels().hashCode();
hash = hash * 23 + getAllProperties().hashCode();
return hash;
}

@Override
public String toString()
{
StringBuilder sb = new StringBuilder( "(" );
getLabels().forEach( l -> sb.append( ":" ).append( l.name() ) );
if ( !getAllProperties().isEmpty() )
{
sb.append( " {" );
getAllProperties().forEach( ( key, value ) -> sb.append( key ).append( ":" ).append( value.toString() ) );
sb.append( "}" );
}
return sb.append( ")" ).toString();
}

public static Node parsedNode( final Iterable<Label> labelNames, final Map<String,Object> properties )
{
return new ParsedNode()
{
@Override
public Map<String,Object> getAllProperties()
{
Expand All @@ -261,4 +290,25 @@ public Iterable<Label> getLabels()
}
};
}

public static Node fromRealNode( Node real )
{
// need to fetch them before the tx closes
final Iterable<Label> realLabels = real.getLabels();
final Map<String,Object> realProps = real.getAllProperties();
return new ParsedNode()
{
@Override
public Map<String,Object> getAllProperties()
{
return realProps;
}

@Override
public Iterable<Label> getLabels()
{
return realLabels;
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public Map<String,Object> getAllProperties()
@Override
public boolean equals( Object obj )
{
if ( obj == this )
{
return true;
}
if ( obj == null )
{
return false;
Expand All @@ -141,13 +145,36 @@ else if ( obj instanceof ParsedRelationship )
{
ParsedRelationship other = (ParsedRelationship) obj;

boolean typeEquality = this.getType().equals( other.getType() );
boolean typeEquality = this.getType().name().equals( other.getType().name() );
boolean propEquality = getAllProperties().equals( other.getAllProperties() );
return typeEquality && propEquality;
}
return false;
}

@Override
public int hashCode()
{
int hash = 3;
hash = hash * 23 + getType().hashCode();
hash = hash * 23 + getAllProperties().hashCode();
return hash;
}

@Override
public String toString()
{
StringBuilder sb = new StringBuilder( "[:" );
sb.append( getType().name() );
if ( !getAllProperties().isEmpty() )
{
sb.append( " {" );
getAllProperties().forEach( ( key, value ) -> sb.append( key ).append( ":" ).append( value.toString() ) );
sb.append( "}" );
}
return sb.append( "]" ).toString();
}

public static Relationship parsedRelationship( final RelationshipType type, final Map<String,Object> properties )
{
return new ParsedRelationship()
Expand All @@ -166,4 +193,24 @@ public RelationshipType getType()
};
}

public static Relationship fromRealRelationship( Relationship real )
{
final RelationshipType type = real.getType();
// need to fetch them before the tx closes
final Map<String,Object> realProps = real.getAllProperties();
return new ParsedRelationship()
{
@Override
public Map<String,Object> getAllProperties()
{
return realProps;
}

@Override
public RelationshipType getType()
{
return type;
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Generated from /Users/mats/gitRoots/3.0-copy/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
// Generated from /Users/mats/gitRoots/3.0-main/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
package cypher.feature.parser.generated;

import org.antlr.v4.runtime.ParserRuleContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Generated from /Users/mats/gitRoots/3.0-copy/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
// Generated from /Users/mats/gitRoots/3.0-main/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
package cypher.feature.parser.generated;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Generated from /Users/mats/gitRoots/3.0-copy/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
// Generated from /Users/mats/gitRoots/3.0-main/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
package cypher.feature.parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Generated from /Users/mats/gitRoots/3.0-copy/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
// Generated from /Users/mats/gitRoots/3.0-main/neo4j/community/cypher/compatibility-suite/src/main/resources/FeatureResults.g4 by ANTLR 4.5.1
package cypher.feature.parser.generated;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
Expand Down Expand Up @@ -984,6 +984,7 @@ public PropertyKeyContext propertyKey() {
public PropertyValueContext propertyValue() {
return getRuleContext(PropertyValueContext.class,0);
}
public TerminalNode WS() { return getToken(FeatureResultsParser.WS, 0); }
public KeyValuePairContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
Expand All @@ -1001,14 +1002,24 @@ public void exitRule(ParseTreeListener listener) {
public final KeyValuePairContext keyValuePair() throws RecognitionException {
KeyValuePairContext _localctx = new KeyValuePairContext(_ctx, getState());
enterRule(_localctx, 30, RULE_keyValuePair);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(141);
propertyKey();
setState(142);
match(T__12);
setState(143);
setState(144);
_la = _input.LA(1);
if (_la==WS) {
{
setState(143);
match(WS);
}
}

setState(146);
propertyValue();
}
}
Expand Down Expand Up @@ -1045,7 +1056,7 @@ public final PropertyKeyContext propertyKey() throws RecognitionException {
try {
enterOuterAlt(_localctx, 1);
{
setState(145);
setState(148);
match(SymbolicNameString);
}
}
Expand Down Expand Up @@ -1084,7 +1095,7 @@ public final PropertyValueContext propertyValue() throws RecognitionException {
try {
enterOuterAlt(_localctx, 1);
{
setState(147);
setState(150);
value();
}
}
Expand Down Expand Up @@ -1123,9 +1134,9 @@ public final RelationshipTypeContext relationshipType() throws RecognitionExcept
try {
enterOuterAlt(_localctx, 1);
{
setState(149);
setState(152);
match(T__12);
setState(150);
setState(153);
relationshipTypeName();
}
}
Expand Down Expand Up @@ -1162,7 +1173,7 @@ public final RelationshipTypeNameContext relationshipTypeName() throws Recogniti
try {
enterOuterAlt(_localctx, 1);
{
setState(152);
setState(155);
match(SymbolicNameString);
}
}
Expand Down Expand Up @@ -1201,9 +1212,9 @@ public final LabelContext label() throws RecognitionException {
try {
enterOuterAlt(_localctx, 1);
{
setState(154);
setState(157);
match(T__12);
setState(155);
setState(158);
labelName();
}
}
Expand Down Expand Up @@ -1240,7 +1251,7 @@ public final LabelNameContext labelName() throws RecognitionException {
try {
enterOuterAlt(_localctx, 1);
{
setState(157);
setState(160);
match(SymbolicNameString);
}
}
Expand Down Expand Up @@ -1277,7 +1288,7 @@ public final StringContext string() throws RecognitionException {
try {
enterOuterAlt(_localctx, 1);
{
setState(159);
setState(162);
match(StringLiteral);
}
}
Expand All @@ -1293,7 +1304,7 @@ public final StringContext string() throws RecognitionException {
}

public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\33\u00a4\4\2\t\2"+
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\33\u00a7\4\2\t\2"+
"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\3\2\3\2\3"+
Expand All @@ -1303,39 +1314,41 @@ public final StringContext string() throws RecognitionException {
"\6\f\6\16\6f\13\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\5\13r\n\13"+
"\3\13\3\13\3\f\3\f\3\f\7\fy\n\f\f\f\16\f|\13\f\3\r\3\r\3\16\3\16\3\17"+
"\3\17\5\17\u0084\n\17\3\17\3\17\3\20\3\20\3\20\7\20\u008b\n\20\f\20\16"+
"\20\u008e\13\20\3\21\3\21\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\24"+
"\3\25\3\25\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\30\2\2\31\2\4\6\b\n\f"+
"\16\20\22\24\26\30\32\34\36 \"$&(*,.\2\4\3\2\24\25\3\2\n\13\u009f\2:\3"+
"\2\2\2\4<\3\2\2\2\6K\3\2\2\2\bV\3\2\2\2\n\\\3\2\2\2\fg\3\2\2\2\16i\3\2"+
"\2\2\20k\3\2\2\2\22m\3\2\2\2\24o\3\2\2\2\26u\3\2\2\2\30}\3\2\2\2\32\177"+
"\3\2\2\2\34\u0081\3\2\2\2\36\u0087\3\2\2\2 \u008f\3\2\2\2\"\u0093\3\2"+
"\2\2$\u0095\3\2\2\2&\u0097\3\2\2\2(\u009a\3\2\2\2*\u009c\3\2\2\2,\u009f"+
"\3\2\2\2.\u00a1\3\2\2\2\60;\5\4\3\2\61;\5\6\4\2\62;\5\b\5\2\63;\5\f\7"+
"\2\64;\5\16\b\2\65;\5.\30\2\66;\5\20\t\2\67;\5\22\n\28;\5\24\13\29;\5"+
"\32\16\2:\60\3\2\2\2:\61\3\2\2\2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2\2\u0085\u0086\7\16\2\2\u0086\35\3\2\2\2\u0087\u008c\5 \21\2\u0088"+
"\u0089\7\t\2\2\u0089\u008b\5 \21\2\u008a\u0088\3\2\2\2\u008b\u008e\3\2"+
"\2\2\u008c\u008a\3\2\2\2\u008c\u008d\3\2\2\2\u008d\37\3\2\2\2\u008e\u008c"+
"\3\2\2\2\u008f\u0090\5\"\22\2\u0090\u0091\7\17\2\2\u0091\u0092\5$\23\2"+
"\u0092!\3\2\2\2\u0093\u0094\7\30\2\2\u0094#\3\2\2\2\u0095\u0096\5\2\2"+
"\2\u0096%\3\2\2\2\u0097\u0098\7\17\2\2\u0098\u0099\5(\25\2\u0099\'\3\2"+
"\2\2\u009a\u009b\7\30\2\2\u009b)\3\2\2\2\u009c\u009d\7\17\2\2\u009d\u009e"+
"\5,\27\2\u009e+\3\2\2\2\u009f\u00a0\7\30\2\2\u00a0-\3\2\2\2\u00a1\u00a2"+
"\7\33\2\2\u00a2/\3\2\2\2\r:@DGQXdqz\u0083\u008c";
"\20\u008e\13\20\3\21\3\21\3\21\5\21\u0093\n\21\3\21\3\21\3\22\3\22\3\23"+
"\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\30"+
"\2\2\31\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\2\4\3\2\24\25"+
"\3\2\n\13\u00a3\2:\3\2\2\2\4<\3\2\2\2\6K\3\2\2\2\bV\3\2\2\2\n\\\3\2\2"+
"\2\fg\3\2\2\2\16i\3\2\2\2\20k\3\2\2\2\22m\3\2\2\2\24o\3\2\2\2\26u\3\2"+
"\2\2\30}\3\2\2\2\32\177\3\2\2\2\34\u0081\3\2\2\2\36\u0087\3\2\2\2 \u008f"+
"\3\2\2\2\"\u0096\3\2\2\2$\u0098\3\2\2\2&\u009a\3\2\2\2(\u009d\3\2\2\2"+
"*\u009f\3\2\2\2,\u00a2\3\2\2\2.\u00a4\3\2\2\2\60;\5\4\3\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2~\31\3\2\2\2\177\u0080\5\34\17\2\u0080\33\3\2\2\2"+
"\u0081\u0083\7\r\2\2\u0082\u0084\5\36\20\2\u0083\u0082\3\2\2\2\u0083\u0084"+
"\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u0086\7\16\2\2\u0086\35\3\2\2\2\u0087"+
"\u008c\5 \21\2\u0088\u0089\7\t\2\2\u0089\u008b\5 \21\2\u008a\u0088\3\2"+
"\2\2\u008b\u008e\3\2\2\2\u008c\u008a\3\2\2\2\u008c\u008d\3\2\2\2\u008d"+
"\37\3\2\2\2\u008e\u008c\3\2\2\2\u008f\u0090\5\"\22\2\u0090\u0092\7\17"+
"\2\2\u0091\u0093\7\31\2\2\u0092\u0091\3\2\2\2\u0092\u0093\3\2\2\2\u0093"+
"\u0094\3\2\2\2\u0094\u0095\5$\23\2\u0095!\3\2\2\2\u0096\u0097\7\30\2\2"+
"\u0097#\3\2\2\2\u0098\u0099\5\2\2\2\u0099%\3\2\2\2\u009a\u009b\7\17\2"+
"\2\u009b\u009c\5(\25\2\u009c\'\3\2\2\2\u009d\u009e\7\30\2\2\u009e)\3\2"+
"\2\2\u009f\u00a0\7\17\2\2\u00a0\u00a1\5,\27\2\u00a1+\3\2\2\2\u00a2\u00a3"+
"\7\30\2\2\u00a3-\3\2\2\2\u00a4\u00a5\7\33\2\2\u00a5/\3\2\2\2\16:@DGQX"+
"dqz\u0083\u008c\u0092";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
Expand Down

0 comments on commit 2617939

Please sign in to comment.