use of jakarta.json.JsonObject in project resteasy by resteasy.
the class AbstractDigestAuthenticationTest method digestAsyncAuth.
@Test
public void digestAsyncAuth() throws Exception {
try (Client client = ClientBuilder.newBuilder().register(HttpAuthenticators.digest(CREDENTIALS_USER_1)).build()) {
final Response response = client.target(TestUtil.generateUri(url, "user")).request(MediaType.APPLICATION_JSON_TYPE).async().get().get(5, TimeUnit.SECONDS);
Assert.assertEquals(Response.Status.OK, response.getStatusInfo());
final JsonObject json = response.readEntity(JsonObject.class);
validate(json);
}
}
use of jakarta.json.JsonObject in project zilla by aklivity.
the class HttpConditionConfigAdapter method adaptFromJson.
@Override
public ConditionConfig adaptFromJson(JsonObject object) {
JsonObject headers = object.containsKey(HEADERS_NAME) ? object.getJsonObject(HEADERS_NAME) : null;
Map<String, String> newHeaders = null;
if (headers != null) {
Map<String, String> newHeaders0 = new LinkedHashMap<>();
headers.forEach((k, v) -> newHeaders0.put(k, JsonString.class.cast(v).getString()));
newHeaders = newHeaders0;
}
return new HttpConditionConfig(newHeaders);
}
use of jakarta.json.JsonObject in project zilla by aklivity.
the class WsOptionsConfigAdapter method adaptFromJson.
@Override
public OptionsConfig adaptFromJson(JsonObject object) {
JsonObject defaults = object.containsKey(DEFAULTS_NAME) ? object.getJsonObject(DEFAULTS_NAME) : null;
String protocol = null;
String scheme = null;
String authority = null;
String path = null;
if (defaults != null) {
if (defaults.containsKey(PROTOCOL_NAME)) {
protocol = defaults.getString(PROTOCOL_NAME);
}
if (defaults.containsKey(SCHEME_NAME)) {
scheme = defaults.getString(SCHEME_NAME);
}
if (defaults.containsKey(AUTHORITY_NAME)) {
authority = defaults.getString(AUTHORITY_NAME);
}
if (defaults.containsKey(PATH_NAME)) {
path = defaults.getString(PATH_NAME);
}
}
return new WsOptionsConfig(protocol, scheme, authority, path);
}
use of jakarta.json.JsonObject in project zilla by aklivity.
the class BindingConfigsAdapter method adaptFromJson.
@Override
public BindingConfig[] adaptFromJson(JsonObject object) {
List<BindingConfig> bindings = new LinkedList<>();
for (String entry : object.keySet()) {
JsonObject item = object.getJsonObject(entry);
String type = item.getString(TYPE_NAME);
route.adaptType(type);
options.adaptType(type);
NamespacedRef vault = item.containsKey(VAULT_NAME) ? NamespacedRef.of(item.getString(VAULT_NAME)) : null;
KindConfig kind = this.kind.adaptFromJson(item.getJsonString(KIND_NAME));
OptionsConfig opts = item.containsKey(OPTIONS_NAME) ? options.adaptFromJson(item.getJsonObject(OPTIONS_NAME)) : null;
MutableInteger order = new MutableInteger();
List<RouteConfig> routes = item.containsKey(ROUTES_NAME) ? item.getJsonArray(ROUTES_NAME).stream().map(JsonValue::asJsonObject).peek(o -> route.adaptFromJsonIndex(order.value++)).map(route::adaptFromJson).collect(toList()) : ROUTES_DEFAULT;
RouteConfig exit = item.containsKey(EXIT_NAME) ? new RouteConfig(routes.size(), item.getString(EXIT_NAME)) : null;
bindings.add(new BindingConfig(vault, entry, type, kind, opts, routes, exit));
}
return bindings.toArray(BindingConfig[]::new);
}
use of jakarta.json.JsonObject in project zilla by aklivity.
the class SchemaTest method shouldValidateServerTcp4SslVersion.
@Test
public void shouldValidateServerTcp4SslVersion() {
JsonObject config = schema.validate("server.tcp4.ssl.version.json");
assertThat(config, not(nullValue()));
}
Aggregations