Search in sources :

Example 31 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method evictThrowsWhenGroupIdNotFound.

@Test(expected = NotFoundException.class)
public void evictThrowsWhenGroupIdNotFound() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndEvictClient(client.getId(), 0xbad2, auditLog, "user", new HashMap<>());
    resource.evictClient(user, new LongParam(Long.toString(client.getId())), new LongParam(Long.toString(0xbad2)));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 32 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method missingGroupAllow.

@Test(expected = NotFoundException.class)
public void missingGroupAllow() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndAllowAccess(secret.getId(), 98, auditLog, "user", new HashMap<>());
    resource.allowAccess(user, new LongParam(Long.toString(secret.getId())), new LongParam("98"));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 33 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method canEnroll.

@Test
public void canEnroll() {
    resource.enrollClient(user, new LongParam(Long.toString(client.getId())), new LongParam(Long.toString(group.getId())));
    verify(aclDAO).findAndEnrollClient(client.getId(), group.getId(), auditLog, "user", new HashMap<>());
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 34 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method canAllowAccess.

@Test
public void canAllowAccess() {
    Response response = resource.allowAccess(user, new LongParam("66"), new LongParam("55"));
    assertThat(response.getStatus()).isEqualTo(200);
    verify(aclDAO).findAndAllowAccess(66, 55, auditLog, "user", new HashMap<>());
}
Also used : Response(javax.ws.rs.core.Response) LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 35 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method canEvict.

@Test
public void canEvict() {
    resource.evictClient(user, new LongParam(Long.toString(client.getId())), new LongParam(Long.toString(group.getId())));
    verify(aclDAO).findAndEvictClient(client.getId(), group.getId(), auditLog, "user", new HashMap<>());
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Aggregations

LongParam (io.dropwizard.jersey.params.LongParam)36 Test (org.junit.Test)34 Response (javax.ws.rs.core.Response)11 SecretDetailResponse (keywhiz.api.SecretDetailResponse)8 ClientDetailResponse (keywhiz.api.ClientDetailResponse)4 Group (keywhiz.api.model.Group)4 GraphHopper (com.graphhopper.GraphHopper)2 Profile (com.graphhopper.config.Profile)2 GHPointParam (com.graphhopper.http.GHPointParam)2 ShortestPathTree (com.graphhopper.isochrone.algorithm.ShortestPathTree)2 RouteResource.errorIfLegacyParameters (com.graphhopper.resources.RouteResource.errorIfLegacyParameters)2 RouteResource.removeLegacyParameters (com.graphhopper.resources.RouteResource.removeLegacyParameters)2 ProfileResolver (com.graphhopper.routing.ProfileResolver)2 QueryGraph (com.graphhopper.routing.querygraph.QueryGraph)2 DefaultSnapFilter (com.graphhopper.routing.util.DefaultSnapFilter)2 FiniteWeightFilter (com.graphhopper.routing.util.FiniteWeightFilter)2 TraversalMode (com.graphhopper.routing.util.TraversalMode)2 EDGE_BASED (com.graphhopper.routing.util.TraversalMode.EDGE_BASED)2 NODE_BASED (com.graphhopper.routing.util.TraversalMode.NODE_BASED)2 BlockAreaWeighting (com.graphhopper.routing.weighting.BlockAreaWeighting)2