Search in sources :

Example 11 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class PatchHandlerTest method startUp.

@BeforeClass
public static void startUp() {
    system = new SystemContext();
    PatchContext context = new PatchContext(system) {

        @Override
        public String directory() {
            return testDirectory();
        }

        @Override
        public FileSystem fileSystem() {
            return new FileSystemMock(vertx);
        }
    };
    handler = new PatchHandler(context);
}
Also used : PatchContext(com.codingchili.patching.configuration.PatchContext) SystemContext(com.codingchili.core.context.SystemContext) PatchHandler(com.codingchili.patching.controller.PatchHandler) FileSystemMock(com.codingchili.core.testing.FileSystemMock) BeforeClass(org.junit.BeforeClass)

Example 12 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class RouterHandlerTest method setUp.

@Before
public void setUp() {
    core = new SystemContext();
    system().setClusterTimeout(500);
    handler = new RouterHandler(new RouterContext(core) {

        @Override
        public RouterSettings service() {
            return new RouterSettings().addExternal(NODE_WEBSERVER, ".*");
        }
    });
    handler.init(core);
}
Also used : RouterSettings(com.codingchili.router.configuration.RouterSettings) SystemContext(com.codingchili.core.context.SystemContext) RouterContext(com.codingchili.router.configuration.RouterContext) Before(org.junit.Before)

Example 13 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class SpellEngine method main.

public static void main(String[] args) {
    RealmSettings settings = new RealmSettings().setName("testing");
    RealmContext.create(new SystemContext(), settings).setHandler(create -> {
        RealmContext rc = create.result();
        InstanceContext ins = new InstanceContext(rc, new InstanceSettings());
        GameContext game = new GameContext(ins);
        SpellEngine engine = new SpellEngine(game);
        JsonObject affConfig = ConfigurationFactory.readObject("/afflictiontest.yaml");
        Affliction affliction = Serializer.unpack(affConfig, Affliction.class);
        Creature target = new ListeningPerson();
        Creature source = new ListeningPerson();
        game.add(target);
        game.add(source);
        for (int i = 0; i < 500; i++) {
            engine.afflict(source, target, affliction.getName());
        }
    });
}
Also used : RealmSettings(com.codingchili.realm.configuration.RealmSettings) RealmContext(com.codingchili.realm.configuration.RealmContext) SystemContext(com.codingchili.core.context.SystemContext) JsonObject(io.vertx.core.json.JsonObject) ListeningPerson(com.codingchili.realm.instance.model.npc.ListeningPerson)

Example 14 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class SimpleEntity method main.

public static void main(String[] args) {
    new StorageLoader<PlayerCreature>().diskIndex(new SystemContext()).withValue(PlayerCreature.class).build(load -> {
        AsyncStorage<PlayerCreature> storage = load.result();
        PlayerCreature c = new PlayerCreature();
        storage.put(c, done -> {
            c.setName("newName");
            storage.update(c, updated -> {
                storage.get(c.id, got -> {
                    System.out.println(got.result().name);
                });
            });
        });
    });
}
Also used : SystemContext(com.codingchili.core.context.SystemContext)

Example 15 with SystemContext

use of com.codingchili.core.context.SystemContext in project chili-core by codingchili.

the class CachedFileStoreTest method setUp.

@Before
public void setUp() {
    Configurations.system().setCachedFilePoll(20);
    CachedFileStore.reset();
    context = new SystemContext();
}
Also used : SystemContext(com.codingchili.core.context.SystemContext)

Aggregations

SystemContext (com.codingchili.core.context.SystemContext)16 Before (org.junit.Before)4 RealmContext (com.codingchili.realm.configuration.RealmContext)2 RealmSettings (com.codingchili.realm.configuration.RealmSettings)2 ListeningPerson (com.codingchili.realm.instance.model.npc.ListeningPerson)2 Async (io.vertx.ext.unit.Async)2 FileSystemMock (com.codingchili.core.testing.FileSystemMock)1 LogContext (com.codingchili.logging.configuration.LogContext)1 PatchContext (com.codingchili.patching.configuration.PatchContext)1 PatchHandler (com.codingchili.patching.controller.PatchHandler)1 SpellTarget (com.codingchili.realm.instance.model.spells.SpellTarget)1 RouterContext (com.codingchili.router.configuration.RouterContext)1 RouterSettings (com.codingchili.router.configuration.RouterSettings)1 JsonObject (io.vertx.core.json.JsonObject)1 BeforeClass (org.junit.BeforeClass)1