@Override public SchemaEntry lookupBySchema(String schema) { return delegate.lookupBySchema(schema); }
@Override public SchemaEntry lookupBySchema(String schema) { return delegate.lookupBySchema(schema); }
/** * Look up an id by a subject + schema pair. * * @param subject * the name of the subject * @param schema * the schema to search for * @return A 200 response with the id in the body, or a 404 response if the * subject or schema is not found */ @POST @Path("{subject}/schema") @Consumes(MediaType.TEXT_PLAIN) public String idFromSchema(@PathParam("subject") String subject, String schema) { return exists(getSubject(subject).lookupBySchema(schema)).getId(); }
/** * Look up an id by a subject + schema pair. * * @param subject * the name of the subject * @param schema * the schema to search for * @return A 200 response with the id in the body, or a 404 response if the * subject or schema is not found */ @POST @Path("{subject}/schema") @Consumes(MediaType.TEXT_PLAIN) public String idFromSchema(@PathParam("subject") String subject, String schema) { return exists(getSubject(subject).lookupBySchema(schema)).getId(); }
Subject subject = repo.lookup(convertSubject.toString(subjectName)); if (subject != null) { SchemaEntry schemaEntry = subject.lookupBySchema(convertSchema.toString(schema)); if (schemaEntry != null) { id = convertId.fromString(schemaEntry.getId());
Subject subject = repo.lookup(convertSubject.toString(subjectName)); if (subject != null) { SchemaEntry schemaEntry = subject.lookupBySchema(convertSchema.toString(schema)); if (schemaEntry != null) { id = convertId.fromString(schemaEntry.getId());
@Test public void testWriteCloseRead() throws Exception { try { repo.register("sub1", null).register("sc1"); repo.register("sub2", null).register("sc2"); repo.register("sub2", null).register("sc3"); } finally { repo.close(); } // Calling close() and createRepository() is like bouncing the repo, to ensure its state persists. repo = createRepository(); try { Subject s1 = repo.lookup("sub1"); Assert.assertNotNull(s1); Subject s2 = repo.lookup("sub2"); Assert.assertNotNull(s2); SchemaEntry e1 = s1.lookupBySchema("sc1"); Assert.assertNotNull(e1); Assert.assertEquals("sc1", e1.getSchema()); SchemaEntry e2 = s2.lookupBySchema("sc2"); Assert.assertNotNull(e2); Assert.assertEquals("sc2", e2.getSchema()); SchemaEntry e3 = s2.lookupBySchema("sc3"); Assert.assertNotNull(e3); Assert.assertEquals("sc3", e3.getSchema()); } finally { repo.close(); } }
Assert.assertEquals(multiLineSchema1, schemaEntry1ById.getSchema()); SchemaEntry schemaEntry1BySchema = s1.lookupBySchema(multiLineSchema1); Assert.assertNotNull(schemaEntry1BySchema); Assert.assertEquals(multiLineSchema1, schemaEntry1BySchema.getSchema()); Assert.assertEquals(multiLineSchema2, schemaEntry2ById.getSchema()); SchemaEntry schemaEntry2BySchema = s1.lookupBySchema(multiLineSchema2); Assert.assertNotNull(schemaEntry2BySchema); Assert.assertEquals(multiLineSchema2, schemaEntry2BySchema.getSchema());
SchemaEntry resultfoo = subject.lookupBySchema(foo.getSchema()); Assert.assertEquals("lookup by Schema did not return same result", foo, resultfoo); SchemaEntry notThere = subject.lookupBySchema("notThere"); Assert.assertNull("non existent schema should return null", notThere);