@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { return delegate.registerIfLatest(schema, latest); }
@Override public SchemaEntry registerIfLatest(String schema, SchemaEntry latest) throws SchemaValidationException { return delegate.registerIfLatest(schema, latest); }
created = s.registerIfLatest(schema, latest); if (null == created) { return Response.status(Status.CONFLICT).build();
created = s.registerIfLatest(schema, latest); if (null == created) { return Response.status(Status.CONFLICT).build();
@Test(expected=IllegalStateException.class) public void testCannotRegisterSchemaIfLatest() throws SchemaValidationException { repo.register(FOO, null); readOnlyRepo.lookup(FOO).registerIfLatest(null, null); }
@Test public void testSuccessfulValidation() throws SchemaValidationException { Subject accept = repo.register(ACCEPT, new SubjectConfig.Builder() .addValidator(ACCEPT_VALIDATOR).build()); SchemaEntry foo = accept.registerIfLatest(FOO, null); Assert.assertNotNull("failed to register schema", foo); SchemaEntry bar = accept.registerIfLatest(BAR, foo); Assert.assertNotNull("failed to register schema", bar); SchemaEntry none = accept.registerIfLatest("nothing", null); Assert.assertNull(none); SchemaEntry baz = accept.register(BAZ); Assert.assertNotNull("failed to register schema", baz); }
@Test(expected=SchemaValidationException.class) public void testCannotRegisterIfLatest() throws SchemaValidationException { Subject reject = repo.register(REJECT, new SubjectConfig.Builder() .addValidator(ValidatorFactory.REJECT_VALIDATOR).build()); reject.registerIfLatest(FOO, null); }
sub.registerIfLatest(FOO, new SchemaEntry("not", "there")); Assert.assertNull( "registerIfLatest must return null if there are no schemas in the " + SchemaEntry foo = sub.registerIfLatest(FOO, null); validateSchemaEntry(FOO, foo); SchemaEntry bar = sub.registerIfLatest(BAR, foo2); validateSchemaEntry(BAR, bar); SchemaEntry none3 = sub.registerIfLatest("none", foo); Assert.assertNull( "registerIfLatest must return null if latest does not match", none3); SchemaEntry none4 = sub.registerIfLatest("none", null); Assert.assertNull( "registerIfLatest must return null if there is a latest schema in"