RecordStoreState { @Nonnull public RecordStoreState withWriteOnlyIndexes(@Nonnull final List<String> writeOnlyIndexNames) { return new RecordStoreState(storeHeader.get(), writeOnlyMap(writeOnlyIndexNames)); } @API(API.Status.INTERNAL)  RecordStoreState(@Nullable RecordMetaDataProto.DataStoreInfo storeHeader, @Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(@Nullable Map<String, IndexState> indexStateMap); @Deprecated  RecordStoreState(); void beginRead(); void endRead(); @Nonnull Map<String, IndexState> getIndexStates(); boolean isWriteOnly(@Nonnull Index index); boolean isWriteOnly(@Nonnull String indexName); boolean isDisabled(@Nonnull Index index); boolean isDisabled(@Nonnull String indexName); boolean isReadable(@Nonnull Index index); boolean isReadable(@Nonnull String indexName); @Nonnull IndexState getState(@Nonnull Index index); @Nonnull IndexState getState(@Nonnull String indexName); boolean allIndexesReadable(); boolean compatibleWith(@Nonnull RecordStoreState other); Set<String> getWriteOnlyIndexNames(); Set<String> getDisabledIndexNames(); @Nonnull RecordStoreState withIndexesInState(@Nonnull final List<String> indexNames,
                                               @Nonnull IndexState state); @Nonnull RecordStoreState withWriteOnlyIndexes(@Nonnull final List<String> writeOnlyIndexNames); @Nonnull RecordMetaDataProto.DataStoreInfo getStoreHeader(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nonnull RecordStoreState toImmutable(); @Nonnull MutableRecordStoreState toMutable(); @Deprecated
    @Nonnull
    static final RecordStoreState EMPTY; }
@Test public void testWithWriteOnlyIndexes() { final String implicitlyReadable = "Implicitly readable"; final String explicitlyReadable = "Explicitly readable"; final String disabled = "Disabled"; final String writeOnly = "Write only"; final String newWriteOnly = "New write only"; RecordStoreState state = stateOf( explicitlyReadable, IndexState.READABLE, disabled, IndexState.DISABLED, writeOnly, IndexState.WRITE_ONLY); assertEquals(IndexState.READABLE, state.getState(implicitlyReadable)); assertEquals(IndexState.READABLE, state.getState(explicitlyReadable)); assertEquals(IndexState.DISABLED, state.getState(disabled)); assertEquals(IndexState.WRITE_ONLY, state.getState(writeOnly)); RecordStoreState newState = state.withWriteOnlyIndexes( Arrays.asList(implicitlyReadable, explicitlyReadable, disabled, writeOnly)); assertEquals(IndexState.WRITE_ONLY, newState.getState(implicitlyReadable)); assertEquals(IndexState.WRITE_ONLY, newState.getState(explicitlyReadable)); assertEquals(IndexState.DISABLED, newState.getState(disabled)); assertEquals(IndexState.WRITE_ONLY, newState.getState(writeOnly)); assertEquals(IndexState.READABLE, newState.getState("other implicitly readable")); assertEquals(IndexState.READABLE, state.getState(implicitlyReadable)); assertEquals(IndexState.READABLE, state.getState(explicitlyReadable)); assertEquals(IndexState.DISABLED, state.getState(disabled)); assertEquals(IndexState.WRITE_ONLY, state.getState(writeOnly)); RecordStoreState newState2 = state.withWriteOnlyIndexes(Collections.singletonList(newWriteOnly)); assertEquals(IndexState.READABLE, newState2.getState(implicitlyReadable)); assertEquals(IndexState.READABLE, newState2.getState(explicitlyReadable)); assertEquals(IndexState.DISABLED, newState2.getState(disabled)); assertEquals(IndexState.WRITE_ONLY, newState2.getState(writeOnly)); assertEquals(IndexState.WRITE_ONLY, newState2.getState(newWriteOnly)); }