@Test public void getLatestSchema_none() throws Exception { road1.setSchemas(Collections.emptyMap()); Optional<SchemaVersion> schema = client.getLatestActiveSchema("road1"); assertThat(schema.isPresent(), is(false)); }
@Override public Optional<SchemaVersion> getLatestActiveSchema(String name) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); return getRoadSchemas(name).values().stream().filter(NOT_DELETED).max(VERSION_COMPARATOR); }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getLatestActiveSchema(String name) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); return getRoadSchemas(name).values().stream().filter(NOT_DELETED).max(VERSION_COMPARATOR); } }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getLatestActiveSchema(String name) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); return getRoadSchemas(name).values().stream().filter(NOT_DELETED).max(VERSION_COMPARATOR); } @Autowired  TollboothSchemaStoreClient(@Value("#{store}") Map<String, Road> store, PatchSetEmitter modificationEmitter); }
TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Optional<SchemaVersion> getLatestActiveSchema(String name) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); return getRoadSchemas(name).values().stream().filter(NOT_DELETED).max(VERSION_COMPARATOR); } @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> getLatestActiveSchema(String name) throws ServiceException, UnknownRoadException { checkNotBlank(name, "name"); return getRoadSchemas(name).values().stream().filter(NOT_DELETED).max(VERSION_COMPARATOR); } @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);  }