@Test public void connectedToInstance() { final SharedShellState state = new SharedShellState(); final AccumuloConnectionDetails connectionDetails = mock(AccumuloConnectionDetails.class); final RyaClient connectedCommands = mock(RyaClient.class); state.connectedToAccumulo(connectionDetails, connectedCommands); state.connectedToInstance("instance"); final ShellState expected = ShellState.builder() .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setAccumuloDetails(connectionDetails) .setConnectedCommands(connectedCommands) .setRyaInstanceName("instance") .build(); assertEquals(expected, state.getShellState()); }
public void connectedToInstance(final String instanceName) throws IllegalStateException { requireNonNull(instanceName); lock.lock(); try { if(shellState.getConnectionState() == ConnectionState.DISCONNECTED) { throw new IllegalStateException("You can not set a Rya Instance Name before connecting to a Rya Storage."); } shellState = ShellState.builder( shellState ) .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setRyaInstanceName( instanceName ) .build(); } finally { lock.unlock(); } }
SharedShellState { public void connectedToInstance(final String instanceName) throws IllegalStateException { requireNonNull(instanceName); lock.lock(); try { if(shellState.getConnectionState() == ConnectionState.DISCONNECTED) { throw new IllegalStateException("You can not set a Rya Instance Name before connecting to a Rya Storage."); } shellState = ShellState.builder( shellState ) .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setRyaInstanceName( instanceName ) .build(); } finally { lock.unlock(); } } }
SharedShellState { public void connectedToInstance(final String instanceName) throws IllegalStateException { requireNonNull(instanceName); lock.lock(); try { if(shellState.getConnectionState() == ConnectionState.DISCONNECTED) { throw new IllegalStateException("You can not set a Rya Instance Name before connecting to a Rya Storage."); } shellState = ShellState.builder( shellState ) .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setRyaInstanceName( instanceName ) .build(); } finally { lock.unlock(); } }  }
SharedShellState { public void connectedToInstance(final String instanceName) throws IllegalStateException { requireNonNull(instanceName); lock.lock(); try { if(shellState.getConnectionState() == ConnectionState.DISCONNECTED) { throw new IllegalStateException("You can not set a Rya Instance Name before connecting to a Rya Storage."); } shellState = ShellState.builder( shellState ) .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setRyaInstanceName( instanceName ) .build(); } finally { lock.unlock(); } }  ShellState getShellState(); void connectedToAccumulo(
            final AccumuloConnectionDetails connectionDetails,
            final RyaClient connectedCommands); void connectedToMongo(
            final MongoConnectionDetails connectionDetails,
            final RyaClient connectedCommands); void connectedToInstance(final String instanceName); void connectedToRyaStreams(
            final RyaStreamsClient ryaStreamsCommands); void disconnected(); }
SharedShellState { public void connectedToInstance(final String instanceName) throws IllegalStateException { requireNonNull(instanceName); lock.lock(); try { if(shellState.getConnectionState() == ConnectionState.DISCONNECTED) { throw new IllegalStateException("You can not set a Rya Instance Name before connecting to a Rya Storage."); } shellState = ShellState.builder( shellState ) .setConnectionState(ConnectionState.CONNECTED_TO_INSTANCE) .setRyaInstanceName( instanceName ) .build(); } finally { lock.unlock(); } }  ShellState getShellState(); void connectedToAccumulo(
            final AccumuloConnectionDetails connectionDetails,
            final RyaClient connectedCommands); void connectedToMongo(
            final MongoConnectionDetails connectionDetails,
            final RyaClient connectedCommands); void connectedToInstance(final String instanceName); void connectedToRyaStreams(
            final RyaStreamsClient ryaStreamsCommands); void disconnected();  }