Search in sources :

Example 21 with JsonbConfig

use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.

the class ReferenceConfigAdapterTest method initJson.

@Before
public void initJson() {
    JsonbConfig config = new JsonbConfig().withAdapters(new NamspaceRefAdapter());
    jsonb = JsonbBuilder.create(config);
}
Also used : JsonbConfig(jakarta.json.bind.JsonbConfig) Before(org.junit.Before)

Example 22 with JsonbConfig

use of jakarta.json.bind.JsonbConfig in project zilla by aklivity.

the class RouteConfigAdapterTest method initJson.

@Before
public void initJson() {
    JsonbConfig config = new JsonbConfig().withAdapters(new RouteAdapter().adaptType("test"));
    jsonb = JsonbBuilder.create(config);
}
Also used : JsonbConfig(jakarta.json.bind.JsonbConfig) Before(org.junit.Before)

Example 23 with JsonbConfig

use of jakarta.json.bind.JsonbConfig in project alias by JohT.

the class TypeReferenceEnhancementIntegrationTest method includedNullValuesDeserializable.

@Test
public void includedNullValuesDeserializable() {
    new TestJsonbConfigProvider().joinConfig(new JsonbConfig().withNullValues(Boolean.TRUE));
    Animal nullContent = new Monkey(null);
    assertEquals(nullContent, serializeAndDeserialize(nullContent));
}
Also used : JsonbConfig(jakarta.json.bind.JsonbConfig) Animal(org.alias.jsonb.typereference.testvalues.animals.Animal) Monkey(org.alias.jsonb.typereference.testvalues.animals.Monkey) Test(org.junit.jupiter.api.Test)

Example 24 with JsonbConfig

use of jakarta.json.bind.JsonbConfig in project alias by JohT.

the class TypeReferenceEnhancementIntegrationTest method serializeAndDeserialize.

@SuppressWarnings("unchecked")
private <T> T serializeAndDeserialize(T object) {
    JsonbConfig config = new TestJsonbConfigProvider().getJsonbConfig();
    Jsonb jsonb = JsonbBuilder.create(config);
    String json = printed(jsonb.toJson(object));
    return (T) jsonb.fromJson(json, object.getClass());
}
Also used : JsonbConfig(jakarta.json.bind.JsonbConfig) Jsonb(jakarta.json.bind.Jsonb)

Example 25 with JsonbConfig

use of jakarta.json.bind.JsonbConfig in project alias by JohT.

the class ImmutableJsonbConfig method join.

/**
 * Returns a new {@link JsonbConfig} that combines the settings of the given {@link JsonbConfig} <br>
 * and this {@link ImmutableJsonbConfig}.
 *
 * @param configToJoin {@link JsonbConfig}
 * @return {@link JsonbConfig}
 */
public JsonbConfig join(JsonbConfig configToJoin) {
    JsonbConfig joinedConfig = getJsonbConfig();
    configToJoin.getAsMap().forEach(joinPropertyInto(joinedConfig));
    return joinedConfig;
}
Also used : JsonbConfig(jakarta.json.bind.JsonbConfig)

Aggregations

JsonbConfig (jakarta.json.bind.JsonbConfig)45 Before (org.junit.Before)28 Jsonb (jakarta.json.bind.Jsonb)12 Test (org.junit.jupiter.api.Test)5 InputStream (java.io.InputStream)4 Files.newInputStream (java.nio.file.Files.newInputStream)3 Path (java.nio.file.Path)3 ZpmSecurity (io.aklivity.zilla.manager.internal.settings.ZpmSecurity)2 Annot8ComponentDescriptor (io.annot8.api.components.Annot8ComponentDescriptor)2 Descriptor (io.annot8.common.serialization.TestNested.Descriptor)2 OutputStream (java.io.OutputStream)2 Files.newOutputStream (java.nio.file.Files.newOutputStream)2 ZpmCredentials (io.aklivity.zilla.manager.internal.settings.ZpmCredentials)1 ZpmSettings (io.aklivity.zilla.manager.internal.settings.ZpmSettings)1 Engine (io.aklivity.zilla.runtime.engine.Engine)1 EngineConfiguration (io.aklivity.zilla.runtime.engine.EngineConfiguration)1 BindingConfig (io.aklivity.zilla.runtime.engine.config.BindingConfig)1 NamespaceConfig (io.aklivity.zilla.runtime.engine.config.NamespaceConfig)1 RouteConfig (io.aklivity.zilla.runtime.engine.config.RouteConfig)1 VaultConfig (io.aklivity.zilla.runtime.engine.config.VaultConfig)1