@Test public void notConnected() { final SharedShellState sharedState = new SharedShellState(); sharedState.disconnected(); final String prompt = new RyaPromptProvider(sharedState).getPrompt(); final String expected = "rya> "; assertEquals(expected, prompt); }
@Override public String getPrompt() { final ShellState state = sharedState.getShellState(); String storageName = "unknown"; if (state.getStorageType().isPresent()) { if (state.getStorageType().get() == StorageType.ACCUMULO) { storageName = state.getAccumuloDetails().get().getInstanceName(); } else if (state.getStorageType().get() == StorageType.MONGO) { storageName = state.getMongoDetails().get().getHostname(); } else { throw new java.lang.IllegalStateException("Missing or unknown storage type."); } } switch(state.getConnectionState()) { case DISCONNECTED: return "rya> "; case CONNECTED_TO_STORAGE: return String.format("rya/%s> ", storageName); case CONNECTED_TO_INSTANCE: return String.format("rya/%s:%s> ", storageName, state.getRyaInstanceName().or("unknown")); default: return "rya> "; } }
RyaPromptProvider extends DefaultPromptProvider { @Override public String getPrompt() { final ShellState state = sharedState.getShellState(); String storageName = "unknown"; if (state.getStorageType().isPresent()) { if (state.getStorageType().get() == StorageType.ACCUMULO) { storageName = state.getAccumuloDetails().get().getInstanceName(); } else if (state.getStorageType().get() == StorageType.MONGO) { storageName = state.getMongoDetails().get().getHostname(); } else { throw new java.lang.IllegalStateException("Missing or unknown storage type."); } } switch(state.getConnectionState()) { case DISCONNECTED: return "rya> "; case CONNECTED_TO_STORAGE: return String.format("rya/%s> ", storageName); case CONNECTED_TO_INSTANCE: return String.format("rya/%s:%s> ", storageName, state.getRyaInstanceName().or("unknown")); default: return "rya> "; } } }
RyaPromptProvider extends DefaultPromptProvider { @Override public String getPrompt() { final ShellState state = sharedState.getShellState(); String storageName = "unknown"; if (state.getStorageType().isPresent()) { if (state.getStorageType().get() == StorageType.ACCUMULO) { storageName = state.getAccumuloDetails().get().getInstanceName(); } else if (state.getStorageType().get() == StorageType.MONGO) { storageName = state.getMongoDetails().get().getHostname(); } else { throw new java.lang.IllegalStateException("Missing or unknown storage type."); } } switch(state.getConnectionState()) { case DISCONNECTED: return "rya> "; case CONNECTED_TO_STORAGE: return String.format("rya/%s> ", storageName); case CONNECTED_TO_INSTANCE: return String.format("rya/%s:%s> ", storageName, state.getRyaInstanceName().or("unknown")); default: return "rya> "; } } @Autowired  RyaPromptProvider(final SharedShellState sharedState); }
RyaPromptProvider extends DefaultPromptProvider { @Override public String getPrompt() { final ShellState state = sharedState.getShellState(); String storageName = "unknown"; if (state.getStorageType().isPresent()) { if (state.getStorageType().get() == StorageType.ACCUMULO) { storageName = state.getAccumuloDetails().get().getInstanceName(); } else if (state.getStorageType().get() == StorageType.MONGO) { storageName = state.getMongoDetails().get().getHostname(); } else { throw new java.lang.IllegalStateException("Missing or unknown storage type."); } } switch(state.getConnectionState()) { case DISCONNECTED: return "rya> "; case CONNECTED_TO_STORAGE: return String.format("rya/%s> ", storageName); case CONNECTED_TO_INSTANCE: return String.format("rya/%s:%s> ", storageName, state.getRyaInstanceName().or("unknown")); default: return "rya> "; } } @Autowired  RyaPromptProvider(final SharedShellState sharedState); @Override String getPrompt(); }
RyaPromptProvider extends DefaultPromptProvider { @Override public String getPrompt() { final ShellState state = sharedState.getShellState(); String storageName = "unknown"; if (state.getStorageType().isPresent()) { if (state.getStorageType().get() == StorageType.ACCUMULO) { storageName = state.getAccumuloDetails().get().getInstanceName(); } else if (state.getStorageType().get() == StorageType.MONGO) { storageName = state.getMongoDetails().get().getHostname(); } else { throw new java.lang.IllegalStateException("Missing or unknown storage type."); } } switch(state.getConnectionState()) { case DISCONNECTED: return "rya> "; case CONNECTED_TO_STORAGE: return String.format("rya/%s> ", storageName); case CONNECTED_TO_INSTANCE: return String.format("rya/%s:%s> ", storageName, state.getRyaInstanceName().or("unknown")); default: return "rya> "; } } @Autowired  RyaPromptProvider(final SharedShellState sharedState); @Override String getPrompt();  }