Skip to content

Commit

Permalink
Merge branch 'master' of github.com:neo4j/community
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewins committed May 27, 2011
2 parents 7d9332c + 7d63eb9 commit 1ee1c2f
Show file tree
Hide file tree
Showing 6 changed files with 694 additions and 394 deletions.
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ the relevant Commercial Agreement.
<dependency>
<groupId>com.tinkerpop</groupId>
<artifactId>gremlin</artifactId>
<version>1.0</version>
<version>0.9</version>
<type>jar</type>
<exclusions>
<!-- Sail support not needed -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,32 @@ public void shouldRespondWith400WhenEndNodeDoesNotExist() throws DatabaseBlocked
response.close();
}

@Test
public void shouldRespondWith201WhenCreatingALoopRelationship() throws Exception
{
long theOnlyNode = helper.createNode();

String jsonString = "{\"to\" : \"" + functionalTestHelper.dataUri() + "node/" + theOnlyNode
+ "\", \"type\" : \"LOVES\"}";
String uri = functionalTestHelper.dataUri() + "node/" + theOnlyNode + "/relationships";
ClientResponse response = CLIENT.resource( uri )
.type( MediaType.APPLICATION_JSON )
.accept( MediaType.APPLICATION_JSON )
.entity( jsonString )
.post( ClientResponse.class );
assertEquals( 201, response.getStatus() );
assertTrue( response.getLocation()
.toString()
.matches( RELATIONSHIP_URI_PATTERN ) );
assertEquals( MediaType.APPLICATION_JSON_TYPE, response.getType() );
assertProperRelationshipRepresentation( JsonHelper.jsonToMap( response.getEntity( String.class ) ) );
gen.create()
.payload( jsonString )
.expectedStatus( 201 )
.post( uri );
response.close();
}

@Test
public void shouldRespondWith400WhenBadJsonProvided() throws DatabaseBlockedException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.neo4j.server.rest.domain.EndNodeNotFoundException;
import org.neo4j.server.rest.domain.RelationshipExpanderBuilder;
import org.neo4j.server.rest.domain.StartNodeNotFoundException;
import org.neo4j.server.rest.domain.StartNodeSameAsEndNodeException;
import org.neo4j.server.rest.domain.TraversalDescriptionBuilder;
import org.neo4j.server.rest.domain.TraverserReturnType;
import org.neo4j.server.rest.repr.DatabaseRepresentation;
Expand Down Expand Up @@ -435,12 +434,9 @@ private RelationshipDirection( Direction internal )
public RelationshipRepresentation createRelationship( long startNodeId, long endNodeId,
String type,
Map<String, Object> properties ) throws StartNodeNotFoundException,
EndNodeNotFoundException, StartNodeSameAsEndNodeException, PropertyValueException
EndNodeNotFoundException, PropertyValueException
{
if ( startNodeId == endNodeId )
{
throw new StartNodeSameAsEndNodeException();
}

Node start, end;
try
{
Expand Down
Loading

0 comments on commit 1ee1c2f

Please sign in to comment.