@Override public void validate(String schemaToValidate, Iterable<SchemaEntry> schemasInOrder) throws SchemaValidationException { throw new SchemaValidationException( "repo.validator.reject validator always rejects validation"); } }
@Override public void validate(String schemaToValidate, Iterable<SchemaEntry> schemasInOrder) throws SchemaValidationException { throw new SchemaValidationException( "repo.validator.reject validator always rejects validation"); } }
@Override public void validate(String schemaToValidate, Iterable<SchemaEntry> schemasInOrder) throws SchemaValidationException { throw new SchemaValidationException("no"); } }
private SchemaEntry handleRegisterRequest(String path, String schema, boolean resourceNotFoundExpected) throws SchemaValidationException { SchemaEntry schemaEntry = null; try { String schemaId = webResource.path(path) .type(MediaType.TEXT_PLAIN_TYPE) .put(String.class, schema); schemaEntry = new SchemaEntry(schemaId, schema); } catch (UniformInterfaceException e) { ClientResponse cr = e.getResponse(); if (ClientResponse.Status.fromStatusCode(cr.getStatus()).equals(FORBIDDEN)) { throw new SchemaValidationException("Invalid schema: " + schema); } else { //any other status should return null handleException(e, format("Failed to register new schema for subject %s", getName()), resourceNotFoundExpected); } } catch (ClientHandlerException e) { handleException(e, format("Failed to register new schema for subject %s", getName()), resourceNotFoundExpected); } return schemaEntry; }
private SchemaEntry handleRegisterRequest(String path, String schema, boolean resourceNotFoundExpected) throws SchemaValidationException { SchemaEntry schemaEntry = null; try { String schemaId = webResource.path(path) .type(MediaType.TEXT_PLAIN_TYPE) .put(String.class, schema); schemaEntry = new SchemaEntry(schemaId, schema); } catch (UniformInterfaceException e) { ClientResponse cr = e.getResponse(); if (ClientResponse.Status.fromStatusCode(cr.getStatus()).equals(FORBIDDEN)) { throw new SchemaValidationException("Invalid schema: " + schema + ". Reason: " + cr.getEntity(String.class)); } else { //any other status should return null handleException(e, format("Failed to register new schema for subject %s", getName()), resourceNotFoundExpected); } } catch (ClientHandlerException e) { handleException(e, format("Failed to register new schema for subject %s", getName()), resourceNotFoundExpected); } return schemaEntry; }
private SchemaEntry handleRegisterRequest(String path, String schema) throws SchemaValidationException { String schemaId; try { schemaId = webResource.path(path).type(MediaType.TEXT_PLAIN_TYPE).put(String.class, schema); return new SchemaEntry(schemaId, schema); } catch (UniformInterfaceException e) { ClientResponse cr = e.getResponse(); if (ClientResponse.Status.fromStatusCode(cr.getStatus()).equals( ClientResponse.Status.FORBIDDEN)) { throw new SchemaValidationException("Invalid schema: " + schema); } else { //any other status should return null return null; } } catch (ClientHandlerException e) { return null; } }
private SchemaEntry handleRegisterRequest(String path, String schema) throws SchemaValidationException { String schemaId; try { schemaId = webResource.path(path).type(MediaType.TEXT_PLAIN_TYPE).put(String.class, schema); return new SchemaEntry(schemaId, schema); } catch (UniformInterfaceException e) { ClientResponse cr = e.getResponse(); if (ClientResponse.Status.fromStatusCode(cr.getStatus()).equals( ClientResponse.Status.FORBIDDEN)) { throw new SchemaValidationException("Invalid schema: " + schema + ". Reason: " + cr.getEntity(String.class)); } else { //any other status should return null return null; } } catch (ClientHandlerException e) { return null; } }