@Test public void testGetUser() throws Exception { context.checking( new Expectations() { { oneOf(client).removeAllFilters(); oneOf(client).addFilter( with(equal(new BasicAuthFilter("admin", "lamepass")))); oneOf(client).resource( new URI( "http: will(returnValue(resource)); oneOf(resource).accept(MediaType.APPLICATION_JSON_TYPE); oneOf(resource).get(AuthIdentity.class); will(returnValue(new AuthIdentity("joe", "joe"))); } }); AuthIdentity user = warpAutenticationManager.getUser("joe"); context.assertIsSatisfied(); assertEquals("joe", user.getUser()); }
public AuthIdentity getUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); return webResource.get(AuthIdentity.class); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing GET user: " + userName, t); } }
WarpAutenticationManager { public AuthIdentity getUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); return webResource.get(AuthIdentity.class); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing GET user: " + userName, t); } } }
WarpAutenticationManager { public AuthIdentity getUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); return webResource.get(AuthIdentity.class); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing GET user: " + userName, t); } } WarpAutenticationManager(
            Client jerseyClient, String warpServerAddr, String warpAdminUser,
            String warpAdminPassword); }
WarpAutenticationManager { public AuthIdentity getUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); return webResource.get(AuthIdentity.class); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing GET user: " + userName, t); } } WarpAutenticationManager(
            Client jerseyClient, String warpServerAddr, String warpAdminUser,
            String warpAdminPassword); AuthIdentity getUser(String userName); void removeUser(String userName); void createUser(AuthIdentity warpUserCredentials); void updateUser(
            String currentUserName,
            AuthIdentity newUserCredentials); }
WarpAutenticationManager { public AuthIdentity getUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); return webResource.get(AuthIdentity.class); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing GET user: " + userName, t); } } WarpAutenticationManager(
            Client jerseyClient, String warpServerAddr, String warpAdminUser,
            String warpAdminPassword); AuthIdentity getUser(String userName); void removeUser(String userName); void createUser(AuthIdentity warpUserCredentials); void updateUser(
            String currentUserName,
            AuthIdentity newUserCredentials);  }