forked from boskworks/bosk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
121 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
bosk-refs/src/test/java/io/vena/bosk/refs/NodeWithRefs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package io.vena.bosk.refs; | ||
|
||
import io.vena.bosk.AbstractBoskTest.TestRoot; | ||
import io.vena.bosk.StateTreeNode; | ||
import io.vena.bosk.Entity; | ||
import io.vena.bosk.Identifier; | ||
import io.vena.bosk.refs.annotations.Ref; | ||
import lombok.Getter; | ||
import lombok.Value; | ||
import lombok.experimental.Accessors; | ||
|
||
@Value | ||
public class NodeWithRefs implements StateTreeNode { | ||
@Ref | ||
TestRoot root; | ||
@Getter | ||
@Accessors(fluent = true) | ||
public class NodeWithRefs implements Entity { | ||
@Ref Identifier id; | ||
@Ref TestRoot root; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
package io.vena.bosk.refs; | ||
|
||
import io.vena.bosk.AbstractBoskTest; | ||
import io.vena.bosk.Bosk; | ||
import io.vena.bosk.Identifier; | ||
import io.vena.bosk.exceptions.InvalidTypeException; | ||
import io.vena.bosk.refs.example.NodeWithRefs_Ref$; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class RefTest extends AbstractBoskTest { | ||
Bosk<NodeWithRefs> bosk; | ||
NodeWithRefs_Ref$ refs; | ||
|
||
@BeforeEach | ||
void setup() throws InvalidTypeException { | ||
bosk = new Bosk<>( | ||
"Test bosk", | ||
NodeWithRefs.class, | ||
new NodeWithRefs(Identifier.from("root"), initialRoot(bosk)), | ||
Bosk::simpleDriver | ||
); | ||
refs = new NodeWithRefs_Ref$(bosk); | ||
} | ||
|
||
@Test | ||
void test() { | ||
|
||
refs.root.get(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
bosk-refs/src/test/java/io/vena/bosk/refs/example/NodeWithRefs_Ref$.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.vena.bosk.refs.example; | ||
|
||
import io.vena.bosk.Bosk; | ||
import io.vena.bosk.Path; | ||
import io.vena.bosk.Reference; | ||
import io.vena.bosk.exceptions.InvalidTypeException; | ||
import io.vena.bosk.refs.NodeWithRefs; | ||
|
||
public class NodeWithRefs_Ref$ { | ||
public final NodeWithRefs_Ref$id id; | ||
public final NodeWithRefs_Ref$root root; | ||
private final Reference<NodeWithRefs> ref; | ||
|
||
public NodeWithRefs_Ref$(Bosk<NodeWithRefs> bosk) throws InvalidTypeException { | ||
this.id = new NodeWithRefs_Ref$id(bosk); | ||
this.root = new NodeWithRefs_Ref$root(bosk); | ||
this.ref = bosk.reference(NodeWithRefs.class, Path.parse( | ||
"/" | ||
)); | ||
} | ||
|
||
public Reference<NodeWithRefs> get() { return ref; } | ||
} |
20 changes: 20 additions & 0 deletions
20
bosk-refs/src/test/java/io/vena/bosk/refs/example/NodeWithRefs_Ref$id.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.vena.bosk.refs.example; | ||
|
||
import io.vena.bosk.Bosk; | ||
import io.vena.bosk.Identifier; | ||
import io.vena.bosk.Path; | ||
import io.vena.bosk.Reference; | ||
import io.vena.bosk.exceptions.InvalidTypeException; | ||
import io.vena.bosk.refs.NodeWithRefs; | ||
|
||
public class NodeWithRefs_Ref$id { | ||
private final Reference<Identifier> ref; | ||
|
||
public NodeWithRefs_Ref$id(Bosk<NodeWithRefs> bosk) throws InvalidTypeException { | ||
this.ref = bosk.reference(Identifier.class, Path.parse( | ||
"/id" | ||
)); | ||
} | ||
|
||
public Reference<Identifier> get() { return ref; } | ||
} |
20 changes: 20 additions & 0 deletions
20
bosk-refs/src/test/java/io/vena/bosk/refs/example/NodeWithRefs_Ref$root.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.vena.bosk.refs.example; | ||
|
||
import io.vena.bosk.AbstractBoskTest; | ||
import io.vena.bosk.Bosk; | ||
import io.vena.bosk.Path; | ||
import io.vena.bosk.Reference; | ||
import io.vena.bosk.exceptions.InvalidTypeException; | ||
import io.vena.bosk.refs.NodeWithRefs; | ||
|
||
public class NodeWithRefs_Ref$root { | ||
private final Reference<AbstractBoskTest.TestRoot> ref; | ||
|
||
public NodeWithRefs_Ref$root(Bosk<NodeWithRefs> bosk) throws InvalidTypeException { | ||
this.ref = bosk.reference(AbstractBoskTest.TestRoot.class, Path.parse( | ||
"/root" | ||
)); | ||
} | ||
|
||
public Reference<AbstractBoskTest.TestRoot> get() { return ref; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters