target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test(expected = APIAccessDeniedException.class) public void testGetDelegationsNoEdOrg() throws Exception { securityContextInjector.setLeaAdminContext(); resource.getDelegations(); } | @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not grant access because no e... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... |
@Test public void testGetTenantIdField() { TenantAndIdEmittableKey key = new TenantAndIdEmittableKey("meta.data.tenantId", "test.id.key.field"); assertEquals(key.getTenantIdField().toString(), "meta.data.tenantId"); } | public Text getTenantIdField() { return fieldNames[TENANT_FIELD]; } | TenantAndIdEmittableKey extends EmittableKey { public Text getTenantIdField() { return fieldNames[TENANT_FIELD]; } } | TenantAndIdEmittableKey extends EmittableKey { public Text getTenantIdField() { return fieldNames[TENANT_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); } | TenantAndIdEmittableKey extends EmittableKey { public Text getTenantIdField() { return fieldNames[TENANT_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); Text getTenantId(); void setTenantId(final Text id); Text getTenantIdField(); Text getId(); vo... | TenantAndIdEmittableKey extends EmittableKey { public Text getTenantIdField() { return fieldNames[TENANT_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); Text getTenantId(); void setTenantId(final Text id); Text getTenantIdField(); Text getId(); vo... |
@Test(expected = MissingConfigException.class) public void missingPassword() throws ParseException, MissingConfigException { String[] args = new String[] { "-u", "user", "-s", "server", "-d", "localDir", "-port", "22" }; propUtils.getUploadProperties(args); } | public UploadProperties getUploadProperties(String[] args) throws ParseException, MissingConfigException { CommandLine cmd = parser.parse(OPTIONS, args); String user = cmd.getOptionValue(FLAG_USER); if (user == null) { throw new MissingConfigException(FLAG_USER); } String password = cmd.getOptionValue(FLAG_PASSWORD); i... | PropertyUtils { public UploadProperties getUploadProperties(String[] args) throws ParseException, MissingConfigException { CommandLine cmd = parser.parse(OPTIONS, args); String user = cmd.getOptionValue(FLAG_USER); if (user == null) { throw new MissingConfigException(FLAG_USER); } String password = cmd.getOptionValue(F... | PropertyUtils { public UploadProperties getUploadProperties(String[] args) throws ParseException, MissingConfigException { CommandLine cmd = parser.parse(OPTIONS, args); String user = cmd.getOptionValue(FLAG_USER); if (user == null) { throw new MissingConfigException(FLAG_USER); } String password = cmd.getOptionValue(F... | PropertyUtils { public UploadProperties getUploadProperties(String[] args) throws ParseException, MissingConfigException { CommandLine cmd = parser.parse(OPTIONS, args); String user = cmd.getOptionValue(FLAG_USER); if (user == null) { throw new MissingConfigException(FLAG_USER); } String password = cmd.getOptionValue(F... | PropertyUtils { public UploadProperties getUploadProperties(String[] args) throws ParseException, MissingConfigException { CommandLine cmd = parser.parse(OPTIONS, args); String user = cmd.getOptionValue(FLAG_USER); if (user == null) { throw new MissingConfigException(FLAG_USER); } String password = cmd.getOptionValue(F... |
@Test public void testGetDelegationsBadRole() throws Exception { securityContextInjector.setEducatorContext(); Assert.assertEquals(Response.Status.FORBIDDEN.getStatusCode(), resource.getDelegations().getStatus()); } | @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not grant access because no e... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... | AdminDelegationResource { @GET @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getDelegations() { SecurityUtil.ensureAuthenticated(); if (SecurityUtil.hasRight(Right.EDORG_DELEGATE)) { String edOrg = SecurityUtil.getEdOrg(); if (edOrg == null) { throw new APIAccessDeniedException("Can not... |
@Test public void testGetSingleDelegation() throws Exception { securityContextInjector.setLeaAdminContext(); ((SLIPrincipal) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).setEdOrg("1234"); ((SLIPrincipal) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).setEdOrgId("1234");... | @GET @Path("myEdOrg") @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getSingleDelegation() { EntityBody entity = getEntity(); if (entity == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.status(Status.OK).entity(entity).build(); } | AdminDelegationResource { @GET @Path("myEdOrg") @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getSingleDelegation() { EntityBody entity = getEntity(); if (entity == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.status(Status.OK).entity(entity).build(); } } | AdminDelegationResource { @GET @Path("myEdOrg") @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getSingleDelegation() { EntityBody entity = getEntity(); if (entity == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.status(Status.OK).entity(entity).build(); } } | AdminDelegationResource { @GET @Path("myEdOrg") @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getSingleDelegation() { EntityBody entity = getEntity(); if (entity == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.status(Status.OK).entity(entity).build(); } @... | AdminDelegationResource { @GET @Path("myEdOrg") @RightsAllowed({Right.EDORG_DELEGATE, Right.EDORG_APP_AUTHZ }) public Response getSingleDelegation() { EntityBody entity = getEntity(); if (entity == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.status(Status.OK).entity(entity).build(); } @... |
@SuppressWarnings("rawtypes") @Test public void testGoodCreate() throws URISyntaxException { when(uriInfo.getRequestUri()).thenReturn(new URI("http: EntityBody app = getNewApp(); Response resp = resource.post(app, uriInfo); assertEquals(STATUS_CREATED, resp.getStatus()); assertTrue("Client id set", app.get(CLIENT_ID).t... | @POST @Override @RightsAllowed({ Right.DEV_APP_CRUD }) public Response post(EntityBody newApp, @Context final UriInfo uriInfo) { if (newApp.containsKey(CLIENT_SECRET) || newApp.containsKey(CLIENT_ID) || newApp.containsKey("id")) { EntityBody body = new EntityBody(); body.put(MESSAGE, "Auto-generated attribute (id|clien... | ApplicationResource extends UnversionedResource { @POST @Override @RightsAllowed({ Right.DEV_APP_CRUD }) public Response post(EntityBody newApp, @Context final UriInfo uriInfo) { if (newApp.containsKey(CLIENT_SECRET) || newApp.containsKey(CLIENT_ID) || newApp.containsKey("id")) { EntityBody body = new EntityBody(); bod... | ApplicationResource extends UnversionedResource { @POST @Override @RightsAllowed({ Right.DEV_APP_CRUD }) public Response post(EntityBody newApp, @Context final UriInfo uriInfo) { if (newApp.containsKey(CLIENT_SECRET) || newApp.containsKey(CLIENT_ID) || newApp.containsKey("id")) { EntityBody body = new EntityBody(); bod... | ApplicationResource extends UnversionedResource { @POST @Override @RightsAllowed({ Right.DEV_APP_CRUD }) public Response post(EntityBody newApp, @Context final UriInfo uriInfo) { if (newApp.containsKey(CLIENT_SECRET) || newApp.containsKey(CLIENT_ID) || newApp.containsKey("id")) { EntityBody body = new EntityBody(); bod... | ApplicationResource extends UnversionedResource { @POST @Override @RightsAllowed({ Right.DEV_APP_CRUD }) public Response post(EntityBody newApp, @Context final UriInfo uriInfo) { if (newApp.containsKey(CLIENT_SECRET) || newApp.containsKey(CLIENT_ID) || newApp.containsKey("id")) { EntityBody body = new EntityBody(); bod... |
@Test public void testBadDelete() throws URISyntaxException { String uuid = "9999999999"; when(uriInfo.getRequestUri()).thenReturn(new URI("http: try { @SuppressWarnings("unused") Response resp = resource.delete(uuid, uriInfo); } catch (EntityNotFoundException e) { assertTrue(true); return; } assertTrue(false); } | @DELETE @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.DEV_APP_CRUD }) public Response delete(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { EntityBody ent = service.get(uuid); if (ent != null) { validateDeveloperHasAccessToApp(ent); } return super.delete(uuid, uriInfo); } | ApplicationResource extends UnversionedResource { @DELETE @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.DEV_APP_CRUD }) public Response delete(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { EntityBody ent = service.get(uuid); if (ent != null) { validateDeveloperHasAccessToApp(ent); } return ... | ApplicationResource extends UnversionedResource { @DELETE @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.DEV_APP_CRUD }) public Response delete(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { EntityBody ent = service.get(uuid); if (ent != null) { validateDeveloperHasAccessToApp(ent); } return ... | ApplicationResource extends UnversionedResource { @DELETE @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.DEV_APP_CRUD }) public Response delete(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { EntityBody ent = service.get(uuid); if (ent != null) { validateDeveloperHasAccessToApp(ent); } return ... | ApplicationResource extends UnversionedResource { @DELETE @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.DEV_APP_CRUD }) public Response delete(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { EntityBody ent = service.get(uuid); if (ent != null) { validateDeveloperHasAccessToApp(ent); } return ... |
@Test public void testGoodGet() throws URISyntaxException { String uuid = createApp(); when(uriInfo.getRequestUri()).thenReturn(new URI("http: Response resp = resource.getWithId(uuid, uriInfo); assertEquals(STATUS_FOUND, resp.getStatus()); } | @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); filterSensitiveData((Map) resp.getEntity()); return r... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... |
@Test public void testBadGet() throws URISyntaxException { String uuid = "9999999999"; when(uriInfo.getRequestUri()).thenReturn(new URI("http: try { Response resp = resource.getWithId(uuid, uriInfo); assertEquals(STATUS_NOT_FOUND, resp.getStatus()); } catch (EntityNotFoundException e) { assertTrue(true); return; } asse... | @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); filterSensitiveData((Map) resp.getEntity()); return r... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... | ApplicationResource extends UnversionedResource { @SuppressWarnings("rawtypes") @GET @Override @Path("{" + UUID + "}") @RightsAllowed({ Right.APP_AUTHORIZE, Right.ADMIN_ACCESS }) public Response getWithId(@PathParam(UUID) String uuid, @Context final UriInfo uriInfo) { Response resp = super.getWithId(uuid, uriInfo); fil... |
@Test public void generateArtifactRequestTest() { ArtifactResolve ar = artifactBindingHelper.generateArtifactResolveRequest("test1234", pkEntry, idpUrl); Assert.assertEquals("test1234", ar.getArtifact().getArtifact()); Assert.assertTrue(ar.isSigned()); Assert.assertNotNull(ar.getSignature().getKeyInfo().getX509Datas())... | protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildOb... | ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAU... | ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAU... | ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAU... | ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAU... |
@Test public void generateSOAPEnvelopeTest() { ArtifactResolve artifactRequest = Mockito.mock(ArtifactResolve.class); Envelope env = artifactBindingHelper.generateSOAPEnvelope(artifactRequest); Assert.assertEquals(artifactRequest, env.getBody().getUnknownXMLObjects().get(0)); Assert.assertEquals(Envelope.DEFAULT_ELEMEN... | protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_ELEMENT_NAME); Body body... | ArtifactBindingHelper { protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_... | ArtifactBindingHelper { protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_... | ArtifactBindingHelper { protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_... | ArtifactBindingHelper { protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_... |
@Test public void testGetAuthForNonExistingAppAndNonExistingAuth() { ResponseImpl resp = (ResponseImpl) res.getAuthorization("someAppId", null); Assert.assertEquals(404, resp.getStatus()); } | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuthForNonExistingAppAndExistingAuth() { Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", "someAppId"); auth.put("edorgs", getAuthList("someOtherEdorg")); repo.create("applicationAuthorization", auth); ResponseImpl resp = (ResponseImpl) res.getAuthorization("s... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetIdField() { TenantAndIdEmittableKey key = new TenantAndIdEmittableKey("meta.data.tenantId", "test.id.key.field"); assertEquals(key.getIdField().toString(), "test.id.key.field"); } | public Text getIdField() { return fieldNames[ID_FIELD]; } | TenantAndIdEmittableKey extends EmittableKey { public Text getIdField() { return fieldNames[ID_FIELD]; } } | TenantAndIdEmittableKey extends EmittableKey { public Text getIdField() { return fieldNames[ID_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); } | TenantAndIdEmittableKey extends EmittableKey { public Text getIdField() { return fieldNames[ID_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); Text getTenantId(); void setTenantId(final Text id); Text getTenantIdField(); Text getId(); void setId(f... | TenantAndIdEmittableKey extends EmittableKey { public Text getIdField() { return fieldNames[ID_FIELD]; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final String idFieldName); Text getTenantId(); void setTenantId(final Text id); Text getTenantIdField(); Text getId(); void setId(f... |
@Test public void testGetAuthForNonExistingAppAndExistingAuth2() { Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", "someAppId"); auth.put("edorgs", getAuthList(SecurityUtil.getEdOrgId())); repo.create("applicationAuthorization", auth); ResponseImpl resp = (ResponseImpl) res.getAuthor... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuthForExistingAppAndNonExistingAuth() { Map<String, Object> appBody = new HashMap<String, Object>(); Entity app = repo.create("application", appBody); ResponseImpl resp = (ResponseImpl) res.getAuthorization(app.getEntityId(), null); Assert.assertEquals(200, resp.getStatus()); Map ent = (Map) r... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuthForExistingAppAndExistingAuth() { Map<String, Object> appBody = new HashMap<String, Object>(); Entity app = repo.create("application", appBody); Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", app.getEntityId()); auth.put("edorgs", getAuthList(SecurityUti... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuthForExistingAppAndExistingAuth2() { Map<String, Object> appBody = new HashMap<String, Object>(); Entity app = repo.create("application", appBody); Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", app.getEntityId()); auth.put("edorgs", getAuthList("someOther... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuthForExistingAppAndExistingAuthAndEdorg() { Map<String, Object> appBody = new HashMap<String, Object>(); Entity app = repo.create("application", appBody); Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", app.getEntityId()); auth.put("edorgs", getAuthList("so... | @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth == null) { Entity appEntity = repo.f... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... | ApplicationAuthorizationResource { @GET @Path("{appId}") @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorization(@PathParam("appId") String appId, @QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); EntityBody appAuth = getAppAuth(appId); if (appAuth =... |
@Test public void testGetAuths() { Map<String, Object> appBody = new HashMap<String, Object>(); Entity app = repo.create("application", appBody); Map<String, Object> auth = new HashMap<String, Object>(); auth.put("applicationId", app.getEntityId()); auth.put("edorgs", getAuthList(SecurityUtil.getEdOrgId())); repo.creat... | @GET @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorizations(@QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); Set<String> inScopeEdOrgs = getChildEdorgs(myEdorgs); SLIPrincipal principal = (SLIPrincipal) SecurityContextHolder.getContext().getAuthen... | ApplicationAuthorizationResource { @GET @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorizations(@QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); Set<String> inScopeEdOrgs = getChildEdorgs(myEdorgs); SLIPrincipal principal = (SLIPrincipal) SecurityC... | ApplicationAuthorizationResource { @GET @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorizations(@QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); Set<String> inScopeEdOrgs = getChildEdorgs(myEdorgs); SLIPrincipal principal = (SLIPrincipal) SecurityC... | ApplicationAuthorizationResource { @GET @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorizations(@QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); Set<String> inScopeEdOrgs = getChildEdorgs(myEdorgs); SLIPrincipal principal = (SLIPrincipal) SecurityC... | ApplicationAuthorizationResource { @GET @RightsAllowed({Right.EDORG_APP_AUTHZ, Right.APP_AUTHORIZE}) public Response getAuthorizations(@QueryParam("edorg") String edorg) { Set<String> myEdorgs = validateEdOrg(edorg); Set<String> inScopeEdOrgs = getChildEdorgs(myEdorgs); SLIPrincipal principal = (SLIPrincipal) SecurityC... |
@Test public void testSLCOperatorOffsetGetSecurityEvents() throws URISyntaxException { injector.setOperatorContext(); URI mockUri = new URI("/rest/securityEvent?limit=100&offset=3"); when(uriInfo.getRequestUri()).thenReturn(mockUri); Response response = resource.getAll(uriInfo); Object responseEntityObj = null; if (res... | @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitie... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... |
@Test public void testSLCOperatorLimitGetSecurityEvents() throws URISyntaxException { injector.setOperatorContext(); URI mockUri = new URI("/rest/securityEvent?limit=2&offset=0"); when(uriInfo.getRequestUri()).thenReturn(mockUri); Response response = resource.getAll(uriInfo); Object responseEntityObj = null; if (respon... | @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitie... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... |
@Test public void testSLCOperatorOffsetLimitGetSecurityEvents() throws URISyntaxException { injector.setOperatorContext(); URI mockUri = new URI("/rest/securityEvent?limit=3&offset=1"); when(uriInfo.getRequestUri()).thenReturn(mockUri); Response response = resource.getAll(uriInfo); Object responseEntityObj = null; if (... | @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitie... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... |
@Test public void testSLCOperatorGetSecurityEvents() { injector.setOperatorContext(); Response response = resource.getAll(uriInfo); Object responseEntityObj = null; if (response.getEntity() instanceof EntityResponse) { EntityResponse resp = (EntityResponse) response.getEntity(); responseEntityObj = resp.getEntity(); } ... | @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitie... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... | SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Re... |
@Test public void testToString() { TenantAndIdEmittableKey key = new TenantAndIdEmittableKey("meta.data.tenantId", "test.id.key.field"); key.setTenantId(new Text("Midgar")); key.setId(new Text("1234")); assertEquals(key.toString(), "TenantAndIdEmittableKey [test.id.key.field=1234, meta.data.tenantId=Midgar]"); } | @Override public String toString() { return "TenantAndIdEmittableKey [" + getIdField() + "=" + getId().toString() + ", " + getTenantIdField() + "=" + getTenantId().toString() + "]"; } | TenantAndIdEmittableKey extends EmittableKey { @Override public String toString() { return "TenantAndIdEmittableKey [" + getIdField() + "=" + getId().toString() + ", " + getTenantIdField() + "=" + getTenantId().toString() + "]"; } } | TenantAndIdEmittableKey extends EmittableKey { @Override public String toString() { return "TenantAndIdEmittableKey [" + getIdField() + "=" + getId().toString() + ", " + getTenantIdField() + "=" + getTenantId().toString() + "]"; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final... | TenantAndIdEmittableKey extends EmittableKey { @Override public String toString() { return "TenantAndIdEmittableKey [" + getIdField() + "=" + getId().toString() + ", " + getTenantIdField() + "=" + getTenantId().toString() + "]"; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final... | TenantAndIdEmittableKey extends EmittableKey { @Override public String toString() { return "TenantAndIdEmittableKey [" + getIdField() + "=" + getId().toString() + ", " + getTenantIdField() + "=" + getTenantId().toString() + "]"; } TenantAndIdEmittableKey(); TenantAndIdEmittableKey(final String tenantIdFieldName, final... |
@Test public void testCreate() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User newUser = new User(); newUser.setGroups(Arrays.asList(R... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testCreateWithOrWithoutLEA() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); Mockito.when(secUtil.hasRight(Right.CRUD_SLC... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testMailValidation() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User userWithNoMail = new User(); userWithNoMail.set... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testNameValidation() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User userWithNoName = new User(); userWithNoName.set... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testNoLastName() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User userWithNoSurname = new User(); userWithNoSurname.s... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testUidValidation() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User userWithNoId = new User(); userWithNoId.setGroup... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testUpdate() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); Mockito.when(secUtil.getUid()).thenReturn(UUID1); User newUs... | @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { return result; } upd... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... |
@Test public void testModifySelf() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(adminService.getAllowedEdOrgs(TENANT, null)).thenReturn( new HashSet<String>(Arrays.asList(EDORG1)))... | @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { return result; } upd... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... |
@Test public void testUpdateLastSEA() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(adminService.getAllowedEdOrgs(TENANT, null)).thenReturn( new HashSet<String>(Arrays.asList(EDORG1... | @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { return result; } upd... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... | UserResource { @PUT @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response update(final User updateUser) { Response result = validateUserUpdate(updateUser, secUtil.getTenantId()); if (result != null) { retur... |
@Test public void testDelete() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); Mockito.when(secUtil.getUid()).thenReturn(UUID1); User newUs... | @DELETE @Path("{uid}") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response delete(@PathParam("uid") final String uid) { Response result = validateUserDelete(uid, secUtil.getTenantId()); if (result != null... | UserResource { @DELETE @Path("{uid}") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response delete(@PathParam("uid") final String uid) { Response result = validateUserDelete(uid, secUtil.getTenantId()); if ... | UserResource { @DELETE @Path("{uid}") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response delete(@PathParam("uid") final String uid) { Response result = validateUserDelete(uid, secUtil.getTenantId()); if ... | UserResource { @DELETE @Path("{uid}") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response delete(@PathParam("uid") final String uid) { Response result = validateUserDelete(uid, secUtil.getTenantId()); if ... | UserResource { @DELETE @Path("{uid}") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response delete(@PathParam("uid") final String uid) { Response result = validateUserDelete(uid, secUtil.getTenantId()); if ... |
@Test public void testGetValue() { BSONObject field = new BasicBSONObject("field", "testing123"); BSONObject entry = new BasicBSONObject("string", field); BSONWritable entity = new BSONWritable(entry); StringValueMapper mapper = new StringValueMapper("string.field"); Writable value = mapper.getValue(entity); assertFals... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); @O... | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); @O... |
@SuppressWarnings("unchecked") @Test public void testReadAll() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); Mockito.when(secUtil.getUid(... | @GET @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response readAll() { String tenant = secUtil.getTenantId(); String edorg = secUtil.getEdOrg(); Response result = validateAdminRights(secUtil.getAllRights(),... | UserResource { @GET @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response readAll() { String tenant = secUtil.getTenantId(); String edorg = secUtil.getEdOrg(); Response result = validateAdminRights(secUtil.... | UserResource { @GET @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response readAll() { String tenant = secUtil.getTenantId(); String edorg = secUtil.getEdOrg(); Response result = validateAdminRights(secUtil.... | UserResource { @GET @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response readAll() { String tenant = secUtil.getTenantId(); String edorg = secUtil.getEdOrg(); Response result = validateAdminRights(secUtil.... | UserResource { @GET @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response readAll() { String tenant = secUtil.getTenantId(); String edorg = secUtil.getEdOrg(); Response result = validateAdminRights(secUtil.... |
@Test public void testGetEdOrgs() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); Mockito.when(secUtil.hasRole(RoleInitializer.LEA_ADMINIST... | @GET @Path("edorgs") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response getEdOrgs() { String tenant = secUtil.getTenantId(); Response result = validateAdminRights(secUtil.getAllRights(), tenant); if (res... | UserResource { @GET @Path("edorgs") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response getEdOrgs() { String tenant = secUtil.getTenantId(); Response result = validateAdminRights(secUtil.getAllRights(), t... | UserResource { @GET @Path("edorgs") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response getEdOrgs() { String tenant = secUtil.getTenantId(); Response result = validateAdminRights(secUtil.getAllRights(), t... | UserResource { @GET @Path("edorgs") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response getEdOrgs() { String tenant = secUtil.getTenantId(); Response result = validateAdminRights(secUtil.getAllRights(), t... | UserResource { @GET @Path("edorgs") @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response getEdOrgs() { String tenant = secUtil.getTenantId(); Response result = validateAdminRights(secUtil.getAllRights(), t... |
@Test public void testBadData() { Collection<GrantedAuthority> rights = new HashSet<GrantedAuthority>(); rights.addAll(Arrays.asList(Right.CRUD_SLC_OPERATOR, Right.CRUD_SEA_ADMIN, Right.CRUD_LEA_ADMIN)); Mockito.when(secUtil.getAllRights()).thenReturn(rights); User newUser = new User(); newUser.setGroups(Arrays.asList(... | @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return result; } newUser.... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... | UserResource { @POST @RightsAllowed({Right.CRUD_LEA_ADMIN, Right.CRUD_SEA_ADMIN, Right.CRUD_SLC_OPERATOR, Right.CRUD_SANDBOX_ADMIN, Right.CRUD_SANDBOX_SLC_OPERATOR }) public final Response create(final User newUser) { Response result = validateUserCreate(newUser, secUtil.getTenantId()); if (result != null) { return res... |
@Test public void testValidateAdminRights() { assertNotNull(resource.validateAdminRights(Arrays.asList(EMPTY_RIGHT), "tenant")); assertNotNull(resource.validateAdminRights(Arrays.asList(NO_ADMIN_RIGHT), "tenant")); assertNull(resource.validateAdminRights(Arrays.asList(ONE_ADMIN_RIGHT_ONLY), "tenant")); assertNull(resou... | Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SLC_OPERATOR) || ... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... |
@Test (expected = RuntimeException.class) public void testValidateAdminBadRights() { assertNull(resource.validateAdminRights(Arrays.asList(ONE_ADMIN_RIGHT_ONLY), null)); } | Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SLC_OPERATOR) || ... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... | UserResource { Response validateAdminRights(Collection<GrantedAuthority> rights, String tenant) { Collection<GrantedAuthority> rightSet = new HashSet<GrantedAuthority>(rights); rightSet.retainAll(Arrays.asList(Right.ALL_ADMIN_CRUD_RIGHTS)); boolean nullTenant = (tenant == null && !(rights.contains(Right.CRUD_SANDBOX_SL... |
@Test public void testValidateAtMostOneAdminRole() { assertNull(UserResource.validateAtMostOneAdminRole(Arrays.asList(new String[] {}))); assertNull(UserResource.validateAtMostOneAdminRole(Arrays .asList(new String[] { RoleInitializer.INGESTION_USER }))); assertNull(UserResource .validateAtMostOneAdminRole(Arrays.asLis... | static Response validateAtMostOneAdminRole(final Collection<String> roles) { Collection<String> adminRoles = new ArrayList<String>(Arrays.asList(ADMIN_ROLES)); adminRoles.retainAll(roles); if (adminRoles.size() > 1) { return composeForbiddenResponse("You cannot assign more than one admin role to a user"); } return null... | UserResource { static Response validateAtMostOneAdminRole(final Collection<String> roles) { Collection<String> adminRoles = new ArrayList<String>(Arrays.asList(ADMIN_ROLES)); adminRoles.retainAll(roles); if (adminRoles.size() > 1) { return composeForbiddenResponse("You cannot assign more than one admin role to a user")... | UserResource { static Response validateAtMostOneAdminRole(final Collection<String> roles) { Collection<String> adminRoles = new ArrayList<String>(Arrays.asList(ADMIN_ROLES)); adminRoles.retainAll(roles); if (adminRoles.size() > 1) { return composeForbiddenResponse("You cannot assign more than one admin role to a user")... | UserResource { static Response validateAtMostOneAdminRole(final Collection<String> roles) { Collection<String> adminRoles = new ArrayList<String>(Arrays.asList(ADMIN_ROLES)); adminRoles.retainAll(roles); if (adminRoles.size() > 1) { return composeForbiddenResponse("You cannot assign more than one admin role to a user")... | UserResource { static Response validateAtMostOneAdminRole(final Collection<String> roles) { Collection<String> adminRoles = new ArrayList<String>(Arrays.asList(ADMIN_ROLES)); adminRoles.retainAll(roles); if (adminRoles.size() > 1) { return composeForbiddenResponse("You cannot assign more than one admin role to a user")... |
@Test(expected = IOException.class) public void testEntityNullCollection() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); EntityBody body = new EntityBody(); body.put("id", "1234"); body.put("name", "test name"); Home response = new Home(null, body); writer.writeTo(response, null, null, n... | @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... |
@Test public void testEntityHome() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); EntityBody body = new EntityBody(); body.put("id", "1234"); body.put("name", "test name"); Home response = new Home("TestEntity", body); writer.writeTo(response, null, null, null, null, null, out); assertNot... | @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... |
@Test(expected = IOException.class) public void testNullObject() throws IOException { EntityBody body = new EntityBody(); body.put("id", "1234"); body.put("name", "test name"); Home response = new Home("TestEntity", body); writer.writeTo(response, null, null, null, null, null, null); } | @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... | ObjectXMLWriter implements MessageBodyWriter { @Override public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { XmlMapper xmlMapper = new XmlMapper(); xmlMapper.config... |
@Test public void testIsWritable() { assertTrue(writer.isWriteable(ErrorResponse.class, null, null, null)); assertTrue(writer.isWriteable(Home.class, null, null, null)); assertFalse(writer.isWriteable(EntityResponse.class, null, null, null)); } | @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.Home") || type.getName().equals("org.slc.sli.api.representation.ErrorResponse")) { return true; } return false; } | ObjectXMLWriter implements MessageBodyWriter { @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.Home") || type.getName().equals("org.slc.sli.api.representation.ErrorResponse")) { return true; } r... | ObjectXMLWriter implements MessageBodyWriter { @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.Home") || type.getName().equals("org.slc.sli.api.representation.ErrorResponse")) { return true; } r... | ObjectXMLWriter implements MessageBodyWriter { @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.Home") || type.getName().equals("org.slc.sli.api.representation.ErrorResponse")) { return true; } r... | ObjectXMLWriter implements MessageBodyWriter { @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.Home") || type.getName().equals("org.slc.sli.api.representation.ErrorResponse")) { return true; } r... |
@Test public void testValueNotFound() { BSONObject field = new BasicBSONObject("field", "testing123"); BSONObject entry = new BasicBSONObject("string", field); BSONWritable entity = new BSONWritable(entry); StringValueMapper mapper = new StringValueMapper("string.missing_field"); Writable value = mapper.getValue(entity... | @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); } | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); @O... | StringValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = BSONUtilities.getValue(entity, fieldName); if (value != null && value instanceof String) { rval = new Text(value); } return rval; } StringValueMapper(String fieldName); @O... |
@Test public void testValues() { final String xmlValues = "<test><k1>v1</k1><k2>v2</k2></test>"; EntityBody body = null; try { body = deserialize(xmlValues); } catch (XMLStreamException e) { fail(e.getMessage()); } assertNotNull(body); assertEquals("v1", body.get("k1")); assertEquals("v2", body.get("k2")); } | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test public void testLists() { final String xmlList = "<test xmlns:sli=\"urn:sli\"><l1 sli:member=\"true\">v1</l1><l1 sli:member=\"true\">v2</l1></test>"; EntityBody body = null; try { body = deserialize(xmlList); } catch (XMLStreamException e) { fail(e.getMessage()); } assertNotNull(body); assertTrue("Should be a lis... | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test public void testMaps() { final String xmlMaps = "<test>" + "<key1>" + "<ek1>ev1</ek1>" + "<ek2>ev2</ek2>" + "</key1>" + "</test>"; EntityBody body = null; try { body = deserialize(xmlMaps); } catch (XMLStreamException e) { fail(e.getMessage()); } assertNotNull(body); assertTrue("Should be a map", body.get("key1")... | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test public void testSomethingComplex() { final String complexXML = "<school xmlns:sli=\"urn:sli\">\n" + " <id>8cc0a1ac-ccb5-dffc-1d74-32964722179b</id>\n" + " <schoolCategories sli:member=\"true\">Middle School</schoolCategories>\n" + " <gradesOffered sli:member=\"true\">Sixth grade</gradesOffered>\n" + " <gradesOffe... | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test(expected = XMLStreamException.class) public void testMissingEndTag() throws XMLStreamException { final String xmlValues = "<test><k1>v1</k1><k2>v2</k2>"; final EntityBody body = deserialize(xmlValues); } | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test(expected = XMLStreamException.class) public void testMalformedXML() throws XMLStreamException { final String xmlValues = "<test><k1>v1</k1><k2>v2</k2></tset>"; final EntityBody body = deserialize(xmlValues); } | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test public void testProcessingInstruction() { final String xmlValues = "<?xml version=\"1.0\" ?><test><k1>v1</k1><k2>v2</k2></test>"; EntityBody body = null; try { body = deserialize(xmlValues); } catch (XMLStreamException e) { fail(); } assertNotNull(body); } | public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } } | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... | StAXMsgBodyReader { public EntityBody deserialize(final InputStream body) throws XMLStreamException { final XMLInputFactory factory = XMLInputFactory.newInstance(); final XMLStreamReader reader = factory.createXMLStreamReader(body); try { return readDocument(reader); } finally { reader.close(); } } EntityBody deserial... |
@Test public void testNullStream() throws IOException { EntityBody body = reader.readFrom(EntityBody.class, null, null, null, null, null); assertNotNull("Should not be null", body); assertTrue("Should be empty", body.isEmpty()); } | @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = null; if (entityStream != null) { try { body = reader.deseri... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... |
@Test public void testBadXml() throws Exception { try { InputStream is = new ByteArrayInputStream("{\"test\":\"foo\"}".getBytes()); reader.readFrom(EntityBody.class, null, null, null, null, is); fail("Should throw Exception because of invalid XML format"); } catch(WebApplicationException wae) { assertEquals(Response.St... | @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = null; if (entityStream != null) { try { body = reader.deseri... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... | XMLMsgBodyReader implements MessageBodyReader<EntityBody> { @Override public EntityBody readFrom(Class<EntityBody> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { EntityBody body = ... |
@Test public void testEntityBody() throws IOException { EntityDefinition def = mock(EntityDefinition.class); when(entityDefinitionStore.lookupByEntityType(anyString())).thenReturn(def); ByteArrayOutputStream out = new ByteArrayOutputStream(); EntityBody body = new EntityBody(); body.put("id", "1234"); body.put("name", ... | @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { try { writeEntity(entityResponse, entityStream); } catch (XMLS... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... |
@Test public void testExtractMultipleTenantsIntoSeparateZipFiles() throws Exception { extractor.execute(); File zipFile1 = new File(extractDir, TENANT1 + ".zip"); Assert.assertTrue(zipFile1.length() > 0); File zipFile2 = new File(extractDir, TENANT2 + ".zip"); Assert.assertTrue(zipFile2.length() > 0); } | @Override public void execute() { Future<String> call; List<Future<String>> futures = new LinkedList<Future<String>>(); for (String tenant : tenants) { try { call = executor.submit(new ExtractWorker(tenant)); futures.add(call); } catch (FileNotFoundException e) { LOG.error("Error while extracting data for tenant " + te... | ExtractorImpl implements Extractor { @Override public void execute() { Future<String> call; List<Future<String>> futures = new LinkedList<Future<String>>(); for (String tenant : tenants) { try { call = executor.submit(new ExtractWorker(tenant)); futures.add(call); } catch (FileNotFoundException e) { LOG.error("Error wh... | ExtractorImpl implements Extractor { @Override public void execute() { Future<String> call; List<Future<String>> futures = new LinkedList<Future<String>>(); for (String tenant : tenants) { try { call = executor.submit(new ExtractWorker(tenant)); futures.add(call); } catch (FileNotFoundException e) { LOG.error("Error wh... | ExtractorImpl implements Extractor { @Override public void execute() { Future<String> call; List<Future<String>> futures = new LinkedList<Future<String>>(); for (String tenant : tenants) { try { call = executor.submit(new ExtractWorker(tenant)); futures.add(call); } catch (FileNotFoundException e) { LOG.error("Error wh... | ExtractorImpl implements Extractor { @Override public void execute() { Future<String> call; List<Future<String>> futures = new LinkedList<Future<String>>(); for (String tenant : tenants) { try { call = executor.submit(new ExtractWorker(tenant)); futures.add(call); } catch (FileNotFoundException e) { LOG.error("Error wh... |
@Test public void testEntityNullCollection() throws IOException { EntityDefinition def = mock(EntityDefinition.class); when(entityDefinitionStore.lookupByEntityType(anyString())).thenReturn(def); ByteArrayOutputStream out = new ByteArrayOutputStream(); EntityBody body = new EntityBody(); body.put("id", "1234"); body.pu... | @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { try { writeEntity(entityResponse, entityStream); } catch (XMLS... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... |
@Test public void testIsWritable() { assertFalse(writer.isWriteable(ErrorResponse.class, null, null, null)); assertFalse(writer.isWriteable(Home.class, null, null, null)); assertTrue(writer.isWriteable(EntityResponse.class, null, null, null)); } | @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.EntityResponse")) { return true; } return false; } | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.EntityResponse")) { return true; } return false; } } | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.EntityResponse")) { return true; } return false; } } | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.EntityResponse")) { return true; } return false; } @Override boolean isWriteabl... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if (type.getName().equals("org.slc.sli.api.representation.EntityResponse")) { return true; } return false; } @Override boolean isWriteabl... |
@Test public void testHandleLists() throws IOException { final EntityDefinition def = mock(EntityDefinition.class); when(entityDefinitionStore.lookupByEntityType(anyString())).thenReturn(def); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final EntityBody body = new EntityBody(); final Map<String, Obje... | @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { try { writeEntity(entityResponse, entityStream); } catch (XMLS... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... | EntityXMLWriter implements MessageBodyWriter<EntityResponse> { @Override public void writeTo(EntityResponse entityResponse, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {... |
@Test public void testGet() throws URISyntaxException { String studentId = resourceService.postEntity(studentResource, createTestEntity()); String sectionId = resourceService.postEntity(sectionResource, createSectionEntity()); String assocId = resourceService.postEntity(ssaResource, createAssociationEntity(studentId, s... | @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.FOUR_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Resource base = resourceHelper.getBaseName(uri... | FourPartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.FOUR_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Res... | FourPartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.FOUR_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Res... | FourPartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.FOUR_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Res... | FourPartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.FOUR_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Res... |
@Test public void testGetPath() { assertTrue(new ChangedUriInfo("/rest/foo/bar", null).getPath().equals("foo/bar")); } | @Override public String getPath() { String uriPath = this.uri.getPath(); if (uriPath != null) { String removeString = "/rest/"; if (uriPath.startsWith(removeString)) { return uriPath.substring(removeString.length()); } return uriPath; } return null; } | ChangedUriInfo implements UriInfo { @Override public String getPath() { String uriPath = this.uri.getPath(); if (uriPath != null) { String removeString = "/rest/"; if (uriPath.startsWith(removeString)) { return uriPath.substring(removeString.length()); } return uriPath; } return null; } } | ChangedUriInfo implements UriInfo { @Override public String getPath() { String uriPath = this.uri.getPath(); if (uriPath != null) { String removeString = "/rest/"; if (uriPath.startsWith(removeString)) { return uriPath.substring(removeString.length()); } return uriPath; } return null; } ChangedUriInfo(String uri, UriIn... | ChangedUriInfo implements UriInfo { @Override public String getPath() { String uriPath = this.uri.getPath(); if (uriPath != null) { String removeString = "/rest/"; if (uriPath.startsWith(removeString)) { return uriPath.substring(removeString.length()); } return uriPath; } return null; } ChangedUriInfo(String uri, UriIn... | ChangedUriInfo implements UriInfo { @Override public String getPath() { String uriPath = this.uri.getPath(); if (uriPath != null) { String removeString = "/rest/"; if (uriPath.startsWith(removeString)) { return uriPath.substring(removeString.length()); } return uriPath; } return null; } ChangedUriInfo(String uri, UriIn... |
@Test public void testGetLearningStandards() throws URISyntaxException { String learningStandardId = resourceService.postEntity(learningStandards, createLearningStandardEntity()); String assessmentId = resourceService.postEntity(assessments, createAssessmentEntity(learningStandardId)); requestURI = new java.net.URI(URI... | @Override public ServiceResponse getLearningStandards(final Resource base, final String idList, final Resource returnResource, final URI requestURI) { final EntityDefinition baseEntityDefinition = resourceHelper.getEntityDefinition(base); final EntityDefinition finalEntityDefinition = resourceHelper.getEntityDefinition... | DefaultAssessmentResourceService implements AssessmentResourceService { @Override public ServiceResponse getLearningStandards(final Resource base, final String idList, final Resource returnResource, final URI requestURI) { final EntityDefinition baseEntityDefinition = resourceHelper.getEntityDefinition(base); final Ent... | DefaultAssessmentResourceService implements AssessmentResourceService { @Override public ServiceResponse getLearningStandards(final Resource base, final String idList, final Resource returnResource, final URI requestURI) { final EntityDefinition baseEntityDefinition = resourceHelper.getEntityDefinition(base); final Ent... | DefaultAssessmentResourceService implements AssessmentResourceService { @Override public ServiceResponse getLearningStandards(final Resource base, final String idList, final Resource returnResource, final URI requestURI) { final EntityDefinition baseEntityDefinition = resourceHelper.getEntityDefinition(base); final Ent... | DefaultAssessmentResourceService implements AssessmentResourceService { @Override public ServiceResponse getLearningStandards(final Resource base, final String idList, final Resource returnResource, final URI requestURI) { final EntityDefinition baseEntityDefinition = resourceHelper.getEntityDefinition(base); final Ent... |
@Test public void testDecoratorNonParam() { MultivaluedMap<String, String> map = new MultivaluedMapImpl(); map.add(ParameterConstants.INCLUDE_CUSTOM, String.valueOf(false)); EntityBody body = createTestEntity(); customEntityDecorator.decorate(body, null, map); assertEquals("Should match", 3, body.keySet().size()); asse... | @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ? params.get(0) : "false"); if (includeCustomEntity)... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... |
@Test public void testDecoratorWithParam() { MultivaluedMap<String, String> map = new MultivaluedMapImpl(); map.add(ParameterConstants.INCLUDE_CUSTOM, String.valueOf(true)); EntityBody custom = createCustomEntity(); EntityService service = mock(EntityService.class); when(service.getCustom("1234")).thenReturn(custom); E... | @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ? params.get(0) : "false"); if (includeCustomEntity)... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... | CustomEntityDecorator implements EntityDecorator { @Override public void decorate(EntityBody entity, EntityDefinition definition, MultivaluedMap<String, String> queryParams) { List<String> params = queryParams.get(ParameterConstants.INCLUDE_CUSTOM); final Boolean includeCustomEntity = Boolean.valueOf((params != null) ?... |
@Test public void testAddTypeCriteria() { EntityDefinition def = entityDefs.lookupByResourceName(ResourceNames.TEACHERS); ApiQuery query = new ApiQuery(); query = resourceServiceHelper.addTypeCriteria(def, query); List<NeutralCriteria> criteriaList = query.getCriteria(); assertEquals("Should match", 1, criteriaList.siz... | protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... |
@Test public void testAddTypeCriteriaNoChange() { EntityDefinition def = entityDefs.lookupByResourceName(ResourceNames.STAFF); ApiQuery query = new ApiQuery(); query = resourceServiceHelper.addTypeCriteria(def, query); List<NeutralCriteria> criteriaList = query.getCriteria(); assertEquals("Should match", 0, criteriaLis... | protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... |
@Test public void testExecute() { WordCountCascading wc = new WordCountCascading(); wc.execute("src/main/resources/short.txt", "target/cascading-result"); System.out.println("completed Cascading word count"); } | public void execute(String inputPath, String outputPath) { Scheme sourceScheme = new TextLine( new Fields( "line" ) ); Tap source = new Hfs( sourceScheme, inputPath ); Scheme sinkScheme = new TextLine( new Fields( "word", "count" ) ); Tap sink = new Hfs( sinkScheme, outputPath, SinkMode.REPLACE ); Pipe assembly = new P... | WordCountCascading { public void execute(String inputPath, String outputPath) { Scheme sourceScheme = new TextLine( new Fields( "line" ) ); Tap source = new Hfs( sourceScheme, inputPath ); Scheme sinkScheme = new TextLine( new Fields( "word", "count" ) ); Tap sink = new Hfs( sinkScheme, outputPath, SinkMode.REPLACE ); ... | WordCountCascading { public void execute(String inputPath, String outputPath) { Scheme sourceScheme = new TextLine( new Fields( "line" ) ); Tap source = new Hfs( sourceScheme, inputPath ); Scheme sinkScheme = new TextLine( new Fields( "word", "count" ) ); Tap sink = new Hfs( sinkScheme, outputPath, SinkMode.REPLACE ); ... | WordCountCascading { public void execute(String inputPath, String outputPath) { Scheme sourceScheme = new TextLine( new Fields( "line" ) ); Tap source = new Hfs( sourceScheme, inputPath ); Scheme sinkScheme = new TextLine( new Fields( "word", "count" ) ); Tap sink = new Hfs( sinkScheme, outputPath, SinkMode.REPLACE ); ... | WordCountCascading { public void execute(String inputPath, String outputPath) { Scheme sourceScheme = new TextLine( new Fields( "line" ) ); Tap source = new Hfs( sourceScheme, inputPath ); Scheme sinkScheme = new TextLine( new Fields( "word", "count" ) ); Tap sink = new Hfs( sinkScheme, outputPath, SinkMode.REPLACE ); ... |
@Test public void testAddTypeCriteriaNullValues() { ApiQuery query = null; assertNull("Should be null", resourceServiceHelper.addTypeCriteria(null, null)); query = new ApiQuery(); query = resourceServiceHelper.addTypeCriteria(null, query); List<NeutralCriteria> criteriaList = query.getCriteria(); assertEquals("Should m... | protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CRITERIA_IN, Arrays.asList... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... | ResourceServiceHelper { protected ApiQuery addTypeCriteria(EntityDefinition entityDefinition, ApiQuery apiQuery) { if (apiQuery != null && entityDefinition != null) { if( !entityDefinition.getType().equals(entityDefinition.getStoredCollectionName())) { apiQuery.addCriteria(new NeutralCriteria("type", NeutralCriteria.CR... |
@Test public void testCreate() { String id = resourceService.postEntity(resource, new EntityBody(createTestEntity())); assertNotNull("ID should not be null", id); } | @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entityIds = definition.getService().createBasedOnContextua... | DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entity... | DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entity... | DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entity... | DefaultResourceService implements ResourceService { @Override @MigratePostedEntity public String postEntity(final Resource resource, EntityBody entity) { EntityDefinition definition = resourceHelper.getEntityDefinition(resource); List<String> entityIds = new ArrayList<String>(); if (SecurityUtil.isStaffUser()) { entity... |
@Test public void testGetEntityType() { assertEquals("Should match", "student", resourceService.getEntityType(new Resource("v1", "students"))); assertEquals("Should match", "staff", resourceService.getEntityType(new Resource("v1", "staff"))); assertEquals("Should match", "teacher", resourceService.getEntityType(new Res... | @Override public String getEntityType(Resource resource) { return resourceHelper.getEntityDefinition(resource).getType(); } | DefaultResourceService implements ResourceService { @Override public String getEntityType(Resource resource) { return resourceHelper.getEntityDefinition(resource).getType(); } } | DefaultResourceService implements ResourceService { @Override public String getEntityType(Resource resource) { return resourceHelper.getEntityDefinition(resource).getType(); } } | DefaultResourceService implements ResourceService { @Override public String getEntityType(Resource resource) { return resourceHelper.getEntityDefinition(resource).getType(); } @PostConstruct void init(); @Override @MigrateResponse ServiceResponse getEntitiesByIds(final Resource resource, final String idList, final URI... | DefaultResourceService implements ResourceService { @Override public String getEntityType(Resource resource) { return resourceHelper.getEntityDefinition(resource).getType(); } @PostConstruct void init(); @Override @MigrateResponse ServiceResponse getEntitiesByIds(final Resource resource, final String idList, final URI... |
@Test public void testGetEntityCount() { String id = resourceService.postEntity(resource, new EntityBody(createTestEntity())); ApiQuery apiQuery = new ApiQuery(); apiQuery.addCriteria(new NeutralCriteria("_id", "in", Arrays.asList(id))); Long count = resourceService.getEntityCount(entityDefs.lookupByResourceName(resour... | protected long getEntityCount(EntityDefinition definition, ApiQuery apiQuery) { long count = 0; if (definition.getService() == null) { return count; } if (apiQuery == null) { return definition.getService().count(new NeutralQuery()); } int originalLimit = apiQuery.getLimit(); int originalOffset = apiQuery.getOffset(); a... | DefaultResourceService implements ResourceService { protected long getEntityCount(EntityDefinition definition, ApiQuery apiQuery) { long count = 0; if (definition.getService() == null) { return count; } if (apiQuery == null) { return definition.getService().count(new NeutralQuery()); } int originalLimit = apiQuery.getL... | DefaultResourceService implements ResourceService { protected long getEntityCount(EntityDefinition definition, ApiQuery apiQuery) { long count = 0; if (definition.getService() == null) { return count; } if (apiQuery == null) { return definition.getService().count(new NeutralQuery()); } int originalLimit = apiQuery.getL... | DefaultResourceService implements ResourceService { protected long getEntityCount(EntityDefinition definition, ApiQuery apiQuery) { long count = 0; if (definition.getService() == null) { return count; } if (apiQuery == null) { return definition.getService().count(new NeutralQuery()); } int originalLimit = apiQuery.getL... | DefaultResourceService implements ResourceService { protected long getEntityCount(EntityDefinition definition, ApiQuery apiQuery) { long count = 0; if (definition.getService() == null) { return count; } if (apiQuery == null) { return definition.getService().count(new NeutralQuery()); } int originalLimit = apiQuery.getL... |
@Test public void testGetAll() throws URISyntaxException { setupMocks(BASE_URI); Response response = publicDefaultResource.getAll(uriInfo); assertEquals("Status code should be OK", Response.Status.OK.getStatusCode(), response.getStatus()); } | @Override @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), true... | PublicDefaultResource extends DefaultResource { @Override @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.get... | PublicDefaultResource extends DefaultResource { @Override @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.get... | PublicDefaultResource extends DefaultResource { @Override @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.get... | PublicDefaultResource extends DefaultResource { @Override @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.get... |
@Test public void testGet() throws URISyntaxException { String learningStandardId = resourceService.postEntity(learningStandards, createLearningStandardEntity()); String assessmentId = resourceService.postEntity(assessments, createAssessmentEntity(learningStandardId)); setupMocks(BASE_URI + "/" + assessmentId + "/learn... | @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Resource base = resourceHelper.getBaseName(ur... | AssessmentResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final ... | AssessmentResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final ... | AssessmentResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final ... | AssessmentResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final ... |
@Test public void testGetResourceClass() { ResourceEndPointTemplate template = new ResourceEndPointTemplate(); template.setResourceClass("templateClass"); assertEquals("Should match", "templateClass", resourceEndPoint.getResourceClass("/students", template)); template.setResourceClass(null); assertEquals("Should match"... | protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } @PostConstruct void load(); List<String> ge... | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } @PostConstruct void load(); List<String> ge... |
@Test(expected = RuntimeException.class) public void testNoClass() { ResourceEndPointTemplate template = new ResourceEndPointTemplate(); template.setResourceClass(null); when(resourceHelper.resolveResourcePath("/students", ResourceTemplate.FOUR_PART)).thenReturn(false); when(resourceHelper.resolveResourcePath("/student... | protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } } | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } @PostConstruct void load(); List<String> ge... | ResourceEndPoint { protected String getResourceClass(final String resourcePath, ResourceEndPointTemplate template) { if (template.getResourceClass() != null) { return template.getResourceClass(); } String resourceClass = bruteForceMatch(resourcePath); return resourceClass; } @PostConstruct void load(); List<String> ge... |
@Test public void testBuildEndPoints() { when(resourceHelper.resolveResourcePath("/students", ResourceTemplate.THREE_PART)).thenReturn(true); ResourceEndPointTemplate template = new ResourceEndPointTemplate(); template.setPath("/students"); template.setResourceClass("someClass"); ResourceEndPointTemplate subResource = ... | protected Map<String, String> buildEndPoints(String nameSpace, String resourcePath, ResourceEndPointTemplate template) { Map<String, String> resources = new HashMap<String, String>(); String fullPath = nameSpace + resourcePath + template.getPath(); resources.put(fullPath, getResourceClass("/rest/" + fullPath, template)... | ResourceEndPoint { protected Map<String, String> buildEndPoints(String nameSpace, String resourcePath, ResourceEndPointTemplate template) { Map<String, String> resources = new HashMap<String, String>(); String fullPath = nameSpace + resourcePath + template.getPath(); resources.put(fullPath, getResourceClass("/rest/" + ... | ResourceEndPoint { protected Map<String, String> buildEndPoints(String nameSpace, String resourcePath, ResourceEndPointTemplate template) { Map<String, String> resources = new HashMap<String, String>(); String fullPath = nameSpace + resourcePath + template.getPath(); resources.put(fullPath, getResourceClass("/rest/" + ... | ResourceEndPoint { protected Map<String, String> buildEndPoints(String nameSpace, String resourcePath, ResourceEndPointTemplate template) { Map<String, String> resources = new HashMap<String, String>(); String fullPath = nameSpace + resourcePath + template.getPath(); resources.put(fullPath, getResourceClass("/rest/" + ... | ResourceEndPoint { protected Map<String, String> buildEndPoints(String nameSpace, String resourcePath, ResourceEndPointTemplate template) { Map<String, String> resources = new HashMap<String, String>(); String fullPath = nameSpace + resourcePath + template.getPath(); resources.put(fullPath, getResourceClass("/rest/" + ... |
@Test public void testLoadNameSpace() throws IOException { String json = "[" + "{\n" + " \"nameSpace\": [\"v6.0\", \"v6.1\"],\n" + " \"resources\":[\n" + " {\n" + " \"path\":\"/reportCards\",\n" + " \"doc\":\"some doc.\"\n" + " }]}," + "{\n" + " \"nameSpace\": [\"v7.0\"],\n" + " \"resources\":[\n" + " {\n" + " \"path\"... | protected ApiNameSpace[] loadNameSpace(InputStream fileStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); ApiNameSpace[] apiNameSpaces = mapper.readValue(fileStream, ApiNameSpace[].class); for (ApiNameSpace apiNameSpace : apiNameSpaces) { String[] nameSpaces = apiNameSpace.getNameSpace(); for (Strin... | ResourceEndPoint { protected ApiNameSpace[] loadNameSpace(InputStream fileStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); ApiNameSpace[] apiNameSpaces = mapper.readValue(fileStream, ApiNameSpace[].class); for (ApiNameSpace apiNameSpace : apiNameSpaces) { String[] nameSpaces = apiNameSpace.getName... | ResourceEndPoint { protected ApiNameSpace[] loadNameSpace(InputStream fileStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); ApiNameSpace[] apiNameSpaces = mapper.readValue(fileStream, ApiNameSpace[].class); for (ApiNameSpace apiNameSpace : apiNameSpaces) { String[] nameSpaces = apiNameSpace.getName... | ResourceEndPoint { protected ApiNameSpace[] loadNameSpace(InputStream fileStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); ApiNameSpace[] apiNameSpaces = mapper.readValue(fileStream, ApiNameSpace[].class); for (ApiNameSpace apiNameSpace : apiNameSpaces) { String[] nameSpaces = apiNameSpace.getName... | ResourceEndPoint { protected ApiNameSpace[] loadNameSpace(InputStream fileStream) throws IOException { ObjectMapper mapper = new ObjectMapper(); ApiNameSpace[] apiNameSpaces = mapper.readValue(fileStream, ApiNameSpace[].class); for (ApiNameSpace apiNameSpace : apiNameSpaces) { String[] nameSpaces = apiNameSpace.getName... |
@Test public void testExecute() throws Exception { WordCountHadoop wc = new WordCountHadoop(); wc.execute("src/main/resources/short.txt", "target/hadoop-result"); System.out.println("completed Hadoop word count"); } | public void execute(String inputPath, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatC... | WordCountHadoop { public void execute(String inputPath, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); j... | WordCountHadoop { public void execute(String inputPath, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); j... | WordCountHadoop { public void execute(String inputPath, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); j... | WordCountHadoop { public void execute(String inputPath, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); j... |
@Test public void testExceptionMethods() { assertEquals("Should match", 2, exception.getAllowedMethods().size()); assertTrue("Should be true", exception.getAllowedMethods().contains("GET")); assertTrue("Should be true", exception.getAllowedMethods().contains("POST")); } | public Set<String> getAllowedMethods() { return allowedMethods; } | MethodNotAllowedException extends RuntimeException { public Set<String> getAllowedMethods() { return allowedMethods; } } | MethodNotAllowedException extends RuntimeException { public Set<String> getAllowedMethods() { return allowedMethods; } MethodNotAllowedException(Set<String> allowedMethods); } | MethodNotAllowedException extends RuntimeException { public Set<String> getAllowedMethods() { return allowedMethods; } MethodNotAllowedException(Set<String> allowedMethods); Set<String> getAllowedMethods(); } | MethodNotAllowedException extends RuntimeException { public Set<String> getAllowedMethods() { return allowedMethods; } MethodNotAllowedException(Set<String> allowedMethods); Set<String> getAllowedMethods(); } |
@Test public void testGet() throws URISyntaxException { String studentId = resourceService.postEntity(studentResource, createTestEntity()); String sectionId = resourceService.postEntity(sectionResource, createSectionEntity()); String assocId = resourceService.postEntity(ssaResource, createAssociationEntity(studentId, s... | @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final Resource base = resourceHelper.getBaseName(ur... | ThreePartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final R... | ThreePartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final R... | ThreePartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final R... | ThreePartResource extends GenericResource { @GET public Response get(@Context final UriInfo uriInfo, @PathParam("id") final String id) { return getAllResponseBuilder.build(uriInfo, ResourceTemplate.THREE_PART, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { final R... |
@Test public void testConstructAndCheckResource() { Resource resourceContainer = responseBuilder.constructAndCheckResource(uriInfo, ResourceTemplate.ONE_PART, ResourceMethod.GET); assertNotNull("Should not be null", resourceContainer); assertEquals("Should match", "v1", resourceContainer.getNamespace()); assertEquals("... | protected Resource constructAndCheckResource(final UriInfo uriInfo, final ResourceTemplate template, final ResourceMethod method) { Resource resource = resourceHelper.getResourceName(uriInfo, template); resourceAccessLog.logAccessToRestrictedEntity(uriInfo, resource, GetResponseBuilder.class.toString()); return resourc... | ResponseBuilder { protected Resource constructAndCheckResource(final UriInfo uriInfo, final ResourceTemplate template, final ResourceMethod method) { Resource resource = resourceHelper.getResourceName(uriInfo, template); resourceAccessLog.logAccessToRestrictedEntity(uriInfo, resource, GetResponseBuilder.class.toString(... | ResponseBuilder { protected Resource constructAndCheckResource(final UriInfo uriInfo, final ResourceTemplate template, final ResourceMethod method) { Resource resource = resourceHelper.getResourceName(uriInfo, template); resourceAccessLog.logAccessToRestrictedEntity(uriInfo, resource, GetResponseBuilder.class.toString(... | ResponseBuilder { protected Resource constructAndCheckResource(final UriInfo uriInfo, final ResourceTemplate template, final ResourceMethod method) { Resource resource = resourceHelper.getResourceName(uriInfo, template); resourceAccessLog.logAccessToRestrictedEntity(uriInfo, resource, GetResponseBuilder.class.toString(... | ResponseBuilder { protected Resource constructAndCheckResource(final UriInfo uriInfo, final ResourceTemplate template, final ResourceMethod method) { Resource resource = resourceHelper.getResourceName(uriInfo, template); resourceAccessLog.logAccessToRestrictedEntity(uriInfo, resource, GetResponseBuilder.class.toString(... |
@Ignore @Test(expected = QueryParseException.class) public void testValidatePublicResourceInvalidQuery() throws URISyntaxException { requestURI = new URI(URI + "?someField=someValue"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Ignore @Test(expected = QueryParseException.class) public void testValidatePublicResourceMultiInvalidQuery() throws URISyntaxException { requestURI = new URI(URI + "?limit=0&someField=someValue&includeFields=somefield"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Test public void testValidatePublicResourceQueryValidQuery() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } } | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Test public void testValidatePublicResourceQueryMultiValidQuery() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0&includeFields=somefield"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception")... | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Test public void testValidateNonPublicResourceFilter() throws URISyntaxException { try { requestURI = new URI(URI + "?someField=someValue"); setupMocks("students"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } } | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Test public void testValidateNonPublicResource() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0"); setupMocks("students"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } } | protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(end... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... | GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.... |
@Ignore @Test public void testGetAll() throws URISyntaxException { setupMocks(BASE_URI); Response response = defaultResource.getAll(uriInfo); assertEquals("Status code should be OK", Response.Status.OK.getStatusCode(), response.getStatus()); } | @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); } | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceSer... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceSer... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceSer... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceSer... |
@Test public void testExecute() throws Exception { BigDiffHadoop bd = new BigDiffHadoop(); bd.execute("src/main/resources/bigdiff/left.txt", "src/main/resources/bigdiff/right-sorted.txt", outputDirectory); System.out.println("completed Hadoop big diff"); } | public void execute(String inputPath1, String inputPath2, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "bigdiff"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setI... | BigDiffHadoop { public void execute(String inputPath1, String inputPath2, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "bigdiff"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.... | BigDiffHadoop { public void execute(String inputPath1, String inputPath2, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "bigdiff"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.... | BigDiffHadoop { public void execute(String inputPath1, String inputPath2, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "bigdiff"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.... | BigDiffHadoop { public void execute(String inputPath1, String inputPath2, String outputPath) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "bigdiff"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.... |
@Ignore @Test public void testPost() throws URISyntaxException { setupMocks(BASE_URI); Response response = defaultResource.post(createTestEntity(), uriInfo); assertEquals("Status code should be OK", Response.Status.CREATED.getStatusCode(), response.getStatus()); assertNotNull("Should not be null", parseIdFromLocation(r... | @POST public Response post(final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, onePartTemplate, ResourceMethod.POST, new ResourceLogic() { @Override public Response run(Resou... | DefaultResource extends GenericResource implements CustomEntityReturnable { @POST public Response post(final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, onePartTemplate, Re... | DefaultResource extends GenericResource implements CustomEntityReturnable { @POST public Response post(final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, onePartTemplate, Re... | DefaultResource extends GenericResource implements CustomEntityReturnable { @POST public Response post(final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, onePartTemplate, Re... | DefaultResource extends GenericResource implements CustomEntityReturnable { @POST public Response post(final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, onePartTemplate, Re... |
@Ignore @Test public void testGetWithId() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); Response response = defaultResource.getWithId(id, uriInfo); EntityResponse entityResponse = (EntityResponse) response.getEntity(); EntityBody body ... | @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEnti... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... |
@Test(expected = EntityNotFoundException.class) public void testGetInvalidId() throws URISyntaxException { setupMocks(BASE_URI + "/1234"); defaultResource.getWithId("1234", uriInfo); } | @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEnti... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... | DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override pu... |
@Test public void testPut() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); Response response = defaultResource.put(id, createTestUpdateEntity(), uriInfo); assertEquals("Status code should be OK", Response.Status.NO_CONTENT.getStatusCode... | @PUT @Path("{id}") public Response put(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.PUT, new Resource... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PUT @Path("{id}") public Response put(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResp... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PUT @Path("{id}") public Response put(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResp... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PUT @Path("{id}") public Response put(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResp... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PUT @Path("{id}") public Response put(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResp... |
@Test public void testPatch() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); Response response = defaultResource.patch(id, createTestPatchEntity(), uriInfo); assertEquals("Status code should be OK", Response.Status.NO_CONTENT.getStatusC... | @PATCH @Path("{id}") public Response patch(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.PATCH, new Re... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PATCH @Path("{id}") public Response patch(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return default... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PATCH @Path("{id}") public Response patch(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return default... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PATCH @Path("{id}") public Response patch(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return default... | DefaultResource extends GenericResource implements CustomEntityReturnable { @PATCH @Path("{id}") public Response patch(@PathParam("id") final String id, final EntityBody entityBody, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(entityBody, uriInfo, SecurityUtil.getSLIPrincipal()); return default... |
@Test(expected = EntityNotFoundException.class) public void testDelete() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); Response response = defaultResource.delete(id, uriInfo); assertEquals("Status code should be OK", Response.Status.NO... | @DELETE @Path("{id}") public Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(null, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.DELETE, new ResourceLogic() { @Override public... | DefaultResource extends GenericResource implements CustomEntityReturnable { @DELETE @Path("{id}") public Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(null, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, tw... | DefaultResource extends GenericResource implements CustomEntityReturnable { @DELETE @Path("{id}") public Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(null, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, tw... | DefaultResource extends GenericResource implements CustomEntityReturnable { @DELETE @Path("{id}") public Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(null, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, tw... | DefaultResource extends GenericResource implements CustomEntityReturnable { @DELETE @Path("{id}") public Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo) { writeValidator.validateWriteRequest(null, uriInfo, SecurityUtil.getSLIPrincipal()); return defaultResponseBuilder.build(uriInfo, tw... |
@Test public void testGetCustomResource() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); CustomEntityResource resource = defaultResource.getCustomResource(id, uriInfo); assertNotNull("Should not be null", resource); } | @Override public CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo) { final Resource resource = resourceHelper.getResourceName(uriInfo, ResourceTemplate.CUSTOM); return new CustomEntityResource(id, resourceHelper.getEntityDefinition(resource.getResourceType()), resourceHelper); } | DefaultResource extends GenericResource implements CustomEntityReturnable { @Override public CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo) { final Resource resource = resourceHelper.getResourceName(uriInfo, ResourceTemplate.CUSTOM); return new CustomEntityResource(id, resourceHelper.get... | DefaultResource extends GenericResource implements CustomEntityReturnable { @Override public CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo) { final Resource resource = resourceHelper.getResourceName(uriInfo, ResourceTemplate.CUSTOM); return new CustomEntityResource(id, resourceHelper.get... | DefaultResource extends GenericResource implements CustomEntityReturnable { @Override public CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo) { final Resource resource = resourceHelper.getResourceName(uriInfo, ResourceTemplate.CUSTOM); return new CustomEntityResource(id, resourceHelper.get... | DefaultResource extends GenericResource implements CustomEntityReturnable { @Override public CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo) { final Resource resource = resourceHelper.getResourceName(uriInfo, ResourceTemplate.CUSTOM); return new CustomEntityResource(id, resourceHelper.get... |
@Test public void testGetEmailFailure() throws Exception { assertNotNull(resource); AnonymousAuthenticationToken anon = new AnonymousAuthenticationToken("anon", "anon", Arrays.<GrantedAuthority>asList(Right.ANONYMOUS_ACCESS)); anon.setAuthenticated(false); SecurityContextHolder.getContext().setAuthentication(anon); try... | @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } @GET @Pa... | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } @GET @Pa... |
@Test public void testGetEmailPass() throws Exception { injector.setEducatorContext(); Map<String, String> returned = (Map<String, String>) resource.getEmail(); assertTrue(returned.get("email").equals(email)); } | @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } } | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } @GET @Pa... | SupportResource { @GET @Path("email") public Object getEmail() { if (!isAuthenticated(SecurityContextHolder.getContext())) { throw new InsufficientAuthenticationException("User must be logged in"); } Map<String, String> emailMap = new HashMap<String, String>(); emailMap.put("email", email); return emailMap; } @GET @Pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.