@Test public void getSchema() throws Exception { road1.setSchemas(schemaVersionsMap); Optional<SchemaVersion> schemaV1 = client.getSchema("road1", 1); Optional<SchemaVersion> schemaV2 = client.getSchema("road1", 2); Optional<SchemaVersion> schemaV3 = client.getSchema("road1", 3); Optional<SchemaVersion> schemaV4 = client.getSchema("road1", 4); assertThat(schemaV1.get().getSchema(), is(schema1)); assertThat(schemaV2.get().getSchema(), is(schema2)); assertThat(schemaV3.get().getSchema(), is(schema3)); assertThat(schemaV4.isPresent(), is(false)); }
@Override public Optional<SchemaVersion> getSchema(String name, int version) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); checkArgument(version > 0, format("Schema version must not be < 1, was: %s", version)); return Optional.ofNullable(getRoadSchemas(name).get(version)); }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getSchema(String name, int version) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); checkArgument(version > 0, format("Schema version must not be < 1, was: %s", version)); return Optional.ofNullable(getRoadSchemas(name).get(version)); } }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getSchema(String name, int version) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); checkArgument(version > 0, format("Schema version must not be < 1, was: %s", version)); return Optional.ofNullable(getRoadSchemas(name).get(version)); } @Autowired  TollboothSchemaStoreClient(@Value("#{store}") Map<String, Road> store, PatchSetEmitter modificationEmitter); }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getSchema(String name, int version) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); checkArgument(version > 0, format("Schema version must not be < 1, was: %s", version)); return Optional.ofNullable(getRoadSchemas(name).get(version)); } @Autowired  TollboothSchemaStoreClient(@Value("#{store}") Map<String, Road> store, PatchSetEmitter modificationEmitter); @Override Optional<SchemaVersion> getSchema(String name, int version); @Override Optional<SchemaVersion> getActiveSchema(String name, int version); @Override Optional<SchemaVersion> getLatestActiveSchema(String name); @Override SchemaVersion registerSchema(String name, Schema schema); @Override SchemaVersion registerSchema(String name, Schema schema, int version); @Override Map<Integer, SchemaVersion> getAllSchemaVersions(String name); @Override Map<Integer, SchemaVersion> getActiveSchemaVersions(String name); @Override void deleteSchemaVersion(String name, int version); }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getSchema(String name, int version) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); checkArgument(version > 0, format("Schema version must not be < 1, was: %s", version)); return Optional.ofNullable(getRoadSchemas(name).get(version)); } @Autowired  TollboothSchemaStoreClient(@Value("#{store}") Map<String, Road> store, PatchSetEmitter modificationEmitter); @Override Optional<SchemaVersion> getSchema(String name, int version); @Override Optional<SchemaVersion> getActiveSchema(String name, int version); @Override Optional<SchemaVersion> getLatestActiveSchema(String name); @Override SchemaVersion registerSchema(String name, Schema schema); @Override SchemaVersion registerSchema(String name, Schema schema, int version); @Override Map<Integer, SchemaVersion> getAllSchemaVersions(String name); @Override Map<Integer, SchemaVersion> getActiveSchemaVersions(String name); @Override void deleteSchemaVersion(String name, int version);  }