Skip to content

Commit

Permalink
Added tests (Currently failing so @ignored) that address issues with …
Browse files Browse the repository at this point in the history
…Generic superclasses in relationship entities.

- Refers to: #54, #66, #186
  • Loading branch information
mangrish committed Dec 8, 2016
1 parent f673202 commit b7cfb68
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.neo4j.ogm.persistence.examples.stage.edges;

import org.neo4j.ogm.annotation.EndNode;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.StartNode;
import org.neo4j.ogm.persistence.examples.stage.nodes.BaseNode;

public abstract class BaseEdge<T extends BaseNode, U extends BaseNode> {

@GraphId
public Long relationshipId;

public String title;

@StartNode
public T start;

@EndNode
public U end;

public BaseEdge() {

}

public BaseEdge(T start, U end, String title) {
this.start = start;
this.end = end;
this.title = title;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.neo4j.ogm.persistence.examples.stage.edges;

import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.persistence.examples.stage.nodes.Drama;
import org.neo4j.ogm.persistence.examples.stage.nodes.StageActor;

@RelationshipEntity(type="LAST_APPEARENCE")
public class LastDrama extends BaseEdge<StageActor, Drama>{

public LastDrama() {
super();
}

public LastDrama(StageActor start, Drama end, String title) {
super(start, end, title);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.neo4j.ogm.persistence.examples.stage.edges;

import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.persistence.examples.stage.nodes.FilmActor;
import org.neo4j.ogm.persistence.examples.stage.nodes.Movie;

@RelationshipEntity(type="LAST_APPEARENCE")
public class LastMovie extends BaseEdge<FilmActor, Movie>{

public LastMovie() {
super();
}

public LastMovie(FilmActor start, Movie end, String title) {
super(start, end, title);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.neo4j.ogm.persistence.examples.stage.edges;

import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.persistence.examples.stage.nodes.Drama;
import org.neo4j.ogm.persistence.examples.stage.nodes.StageActor;

@RelationshipEntity(type="PLAYED_IN")
public class PlayedInDrama extends BaseEdge<StageActor, Drama>{

public PlayedInDrama() {
super();
}

public PlayedInDrama(StageActor start, Drama end, String title) {
super(start, end, title);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.neo4j.ogm.persistence.examples.stage.edges;

import org.neo4j.ogm.annotation.RelationshipEntity;
import org.neo4j.ogm.persistence.examples.stage.nodes.FilmActor;
import org.neo4j.ogm.persistence.examples.stage.nodes.Movie;

@RelationshipEntity(type="PLAYED_IN")
public class PlayedInMovie extends BaseEdge<FilmActor, Movie>{

public PlayedInMovie() {
super();
}

public PlayedInMovie(FilmActor start, Movie end, String title) {
super(start, end, title);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.neo4j.ogm.persistence.examples.stage.nodes;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;

@NodeEntity
public class BaseNode {

@GraphId
public Long id;

public String title;

public BaseNode() {

}

public BaseNode(String title) {
this.title = title;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.neo4j.ogm.persistence.examples.stage.nodes;

import org.neo4j.ogm.annotation.NodeEntity;

@NodeEntity
public class Drama extends BaseNode {

public Drama() {
super();
}

public Drama(String title) {
super(title);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.neo4j.ogm.persistence.examples.stage.nodes;


import java.util.HashSet;
import java.util.Set;

import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
import org.neo4j.ogm.persistence.examples.stage.edges.LastMovie;
import org.neo4j.ogm.persistence.examples.stage.edges.PlayedInMovie;

@NodeEntity
public class FilmActor extends BaseNode {
public FilmActor(){
super();
}
public FilmActor(String title){
super(title);
}

@Relationship(type="PLAYED_IN")
public Set<PlayedInMovie> movies = new HashSet<>();

@Relationship(type = "LAST_APPEARENCE")
public LastMovie lastMovie;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.neo4j.ogm.persistence.examples.stage.nodes;

import org.neo4j.ogm.annotation.NodeEntity;

@NodeEntity
public class Movie extends BaseNode {

public Movie() {
super();
}

public Movie(String title) {
super(title);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.neo4j.ogm.persistence.examples.stage.nodes;

import java.util.HashSet;
import java.util.Set;

import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
import org.neo4j.ogm.persistence.examples.stage.edges.LastDrama;
import org.neo4j.ogm.persistence.examples.stage.edges.PlayedInDrama;

@NodeEntity
public class StageActor extends BaseNode {
public StageActor() { super(); }
public StageActor(String title) { super(title); }

@Relationship(type="PLAYED_IN")
public Set<PlayedInDrama> dramas = new HashSet<>();

@Relationship(type = "LAST_APPEARENCE")
public LastDrama lastDrama;

}

This file was deleted.

Loading

0 comments on commit b7cfb68

Please sign in to comment.