use of org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler in project qi4j-sdk by Qi4j.
the class RssReaderTest method assemble.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
// General setup of client
new OrgJsonValueSerializationAssembler().assemble(module);
new ClientAssembler().assemble(module);
new ValueAssembler().assemble(module);
}
use of org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler in project qi4j-sdk by Qi4j.
the class VoldemortTest method assemble.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
super.assemble(module);
ModuleAssembly config = module.layer().module("config");
new EntityTestAssembler().assemble(config);
config.entities(VoldemortConfiguration.class).visibleIn(Visibility.layer);
new OrgJsonValueSerializationAssembler().assemble(module);
new VoldemortAssembler(Visibility.layer).assemble(module);
}
use of org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler in project qi4j-sdk by Qi4j.
the class RDFAssembler method assemble.
public void assemble(ModuleAssembly module) throws AssemblyException {
new OrgJsonValueSerializationAssembler().assemble(module);
module.objects(EntityStateSerializer.class).visibleIn(Visibility.application);
module.objects(EntityTypeSerializer.class).visibleIn(Visibility.application);
}
use of org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler in project qi4j-sdk by Qi4j.
the class DocumentationSupport method assembledWithValuesModuleSerialization.
// END SNIPPET: io
@Test
public // TODO Include in each ValueSerialization extensions documentation
void assembledWithValuesModuleSerialization() throws Exception {
Application app = new Energy4Java().newApplication(new ApplicationAssembler() {
@Override
public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException {
Assembler[][][] pancakes = new Assembler[][][] { { { new Assembler() {
@Override
public void assemble(ModuleAssembly valuesModule) throws AssemblyException {
valuesModule.layer().setName("SINGLE-Layer");
valuesModule.setName("VALUES-Module");
valuesModule.values(SomeValue.class);
}
} }, { new Assembler() {
@Override
public void assemble(ModuleAssembly servicesModule) throws AssemblyException {
servicesModule.setName("SERVICES-Module");
Function<Application, Module> valuesModuleFinder = new Function<Application, Module>() {
@Override
public Module map(Application app) {
return app.findModule("SINGLE-Layer", "VALUES-Module");
}
};
new OrgJsonValueSerializationAssembler().withValuesModuleFinder(valuesModuleFinder).assemble(servicesModule);
}
} } } };
return applicationFactory.newApplicationAssembly(pancakes);
}
});
app.activate();
try {
Module valuesModule = app.findModule("SINGLE-Layer", "VALUES-Module");
SomeValue someValue = someNewValueInstance(valuesModule);
Module servicesModule = app.findModule("SINGLE-Layer", "SERVICES-Module");
ValueSerialization valueSerialization = servicesModule.findService(ValueSerialization.class).get();
String json = valueSerialization.serialize(someValue);
assertThat(json, equalTo("{\"foo\":\"bar\"}"));
SomeValue someNewValue = valueSerialization.deserialize(SomeValue.class, json);
assertThat(someNewValue, equalTo(someValue));
} finally {
app.passivate();
}
}
use of org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler in project qi4j-sdk by Qi4j.
the class JavaLevelDBEntityStoreTest method assemble.
@Override
public // START SNIPPET: assembly
void assemble(ModuleAssembly module) throws AssemblyException {
// END SNIPPET: assembly
super.assemble(module);
ModuleAssembly config = module.layer().module("config");
new EntityTestAssembler(Visibility.module).assemble(config);
new OrgJsonValueSerializationAssembler().assemble(module);
module.services(FileConfigurationService.class);
// START SNIPPET: assembly
new LevelDBEntityStoreAssembler().withConfig(config, Visibility.layer).identifiedBy("java-leveldb-entitystore").assemble(module);
// END SNIPPET: assembly
config.forMixin(LevelDBEntityStoreConfiguration.class).declareDefaults().flavour().set("java");
// START SNIPPET: assembly
}
Aggregations