Skip to content

Commit

Permalink
Catch up w/ API changes in 1.2.7 (#137)
Browse files Browse the repository at this point in the history
Catch up w/ API changes in 1.2.7
  • Loading branch information
wwerner authored Mar 6, 2020
2 parents cf03ce6 + 26d2b0a commit f67e55a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/main/java/io/vlingo/schemata/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

package io.vlingo.schemata;

import io.vlingo.actors.Grid;
import io.vlingo.actors.GridAddressFactory;
import io.vlingo.actors.Stage;
import io.vlingo.actors.World;
import io.vlingo.common.identity.IdentityGeneratorType;
import io.vlingo.http.resource.Configuration;
import io.vlingo.http.resource.Resources;
import io.vlingo.http.resource.Server;
import io.vlingo.lattice.grid.Grid;
import io.vlingo.lattice.grid.GridAddressFactory;
import io.vlingo.lattice.model.object.ObjectTypeRegistry;
import io.vlingo.schemata.infra.persistence.SchemataObjectStore;
import io.vlingo.schemata.query.Queries;
Expand All @@ -39,7 +39,8 @@ public Bootstrap(final String runtimeType) throws Exception {
SchemataConfig config = SchemataConfig.forRuntime(runtimeType);

world = World.startWithDefaults("vlingo-schemata");
world.stageNamed(StageName, Grid.class, new GridAddressFactory(IdentityGeneratorType.RANDOM));
// TODO: Start an actual Grid here using Grid.start(...). Needs a complete grid configuration first
world.stageNamed(StageName, Stage.class, new GridAddressFactory(IdentityGeneratorType.RANDOM));

final NoopDispatcher<TextEntry, TextState> dispatcher = new NoopDispatcher<>();

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/io/vlingo/schemata/model/ContextEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ protected void stateObject(final ContextState stateObject) {
protected Class<ContextState> stateObjectType() {
return ContextState.class;
}

@Override
public void applyRelocationSnapshot(String snapshot) {
stateObject(ContextState.from(ContextId.existing(snapshot)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ protected void stateObject(final OrganizationState stateObject) {
protected Class<OrganizationState> stateObjectType() {
return OrganizationState.class;
}

@Override
public void applyRelocationSnapshot(String snapshot) {
stateObject(OrganizationState.from(OrganizationId.existing(snapshot)));
}

}
5 changes: 5 additions & 0 deletions src/main/java/io/vlingo/schemata/model/SchemaEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ protected void stateObject(final SchemaState stateObject) {
protected Class<SchemaState> stateObjectType() {
return SchemaState.class;
}

@Override
public void applyRelocationSnapshot(String snapshot) {
stateObject(SchemaState.from(SchemaId.existing(snapshot)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,10 @@ private static TypeDefinition asTypeDefinition(Node n) {
private static FieldDefinition asFieldDefinition(Node n) {
return Processor.requireBeing(n, FieldDefinition.class);
}

@Override
public void applyRelocationSnapshot(String snapshot) {
stateObject(SchemaVersionState.from(SchemaVersionId.existing(snapshot)));
}

}
6 changes: 6 additions & 0 deletions src/main/java/io/vlingo/schemata/model/UnitEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,10 @@ protected void stateObject(final UnitState stateObject) {
protected Class<UnitState> stateObjectType() {
return UnitState.class;
}

@Override
public void applyRelocationSnapshot(String snapshot) {
stateObject(UnitState.from(UnitId.existing(snapshot)));
}

}
9 changes: 4 additions & 5 deletions src/test/java/io/vlingo/schemata/resource/ResourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@

package io.vlingo.schemata.resource;

import io.vlingo.actors.*;
import io.vlingo.http.Response;
import io.vlingo.http.ResponseHeader;
import io.vlingo.schemata.SchemataConfig;
import org.junit.Before;

import io.vlingo.actors.Stage;
import io.vlingo.actors.World;
import io.vlingo.common.identity.IdentityGeneratorType;
import io.vlingo.lattice.grid.Grid;
import io.vlingo.lattice.grid.GridAddressFactory;
import io.vlingo.lattice.model.object.ObjectTypeRegistry;
import io.vlingo.schemata.NoopDispatcher;
import io.vlingo.schemata.Schemata;
Expand All @@ -37,6 +34,7 @@ public abstract class ResourceTest {
protected ObjectStore objectStore;
protected ObjectTypeRegistry registry;
protected Stage stage;
protected Grid grid;
protected World world;

protected OrganizationQueries organizationQueries;
Expand All @@ -50,7 +48,8 @@ public abstract class ResourceTest {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setUp() throws Exception {
world = World.startWithDefaults("test-command-router");
world.stageNamed(Schemata.StageName, Grid.class, new GridAddressFactory(IdentityGeneratorType.RANDOM));
// TODO: Start an actual Grid here using Grid.start(...). Needs a test grid configuration first
world.stageNamed(Schemata.StageName, Stage.class, new GridAddressFactory(IdentityGeneratorType.RANDOM));
stage = world.stageNamed(Schemata.StageName);

final SchemataObjectStore schemataObjectStore = SchemataObjectStore.instance(SchemataConfig.forRuntime("test"));
Expand Down

0 comments on commit f67e55a

Please sign in to comment.