@Delete("/1/applications/:name/:pushService") @Delete("/1/applications/:name/:pushService/") public Payload deleteApplication(String name, String pushService) { io.spacedog.utils.Credentials credentials = SpaceContext.checkAdminCredentials(); PushApplication pushApp = new PushApplication(); pushApp.backendId = credentials.backendId(); pushApp.name = name; pushApp.service = PushService.valueOf(pushService); Optional<PlatformApplication> application = getPlatformApplication(pushApp); if (application.isPresent()) { String applicationArn = application.get().getPlatformApplicationArn(); PushResource.get().getSnsClient().deletePlatformApplication(// new DeletePlatformApplicationRequest()// .withPlatformApplicationArn(applicationArn)); } return JsonPayload.success(); }
@Test public void testConstructor() throws Exception { ApplicationArn arn1 = new ApplicationArn("a1"); DeletePlatformApplicationRequest r = new DeletePlatformApplicationRequestBuilder(arn1) .getRequest(); assertEquals(arn1.toString(), r.getPlatformApplicationArn()); }
@Test public void testPlatformApplicationArn() throws Exception { ApplicationArn arn1 = new ApplicationArn("a1"); ApplicationArn arn2 = new ApplicationArn("a2"); DeletePlatformApplicationRequest r = new DeletePlatformApplicationRequestBuilder(arn1) .platformApplicationArn(arn2) .getRequest(); assertEquals(arn2.toString(), r.getPlatformApplicationArn()); }
@Test public void testRequestCredentials() throws Exception { ApplicationArn arn1 = new ApplicationArn("a1"); AWSCredentials mockCredentials = mock(AWSCredentials.class); DeletePlatformApplicationRequest r = new DeletePlatformApplicationRequestBuilder(arn1) .requestCredentials(mockCredentials) .getRequest(); assertEquals(mockCredentials, r.getRequestCredentials()); }
@Test public void testGetRequest() throws Exception { ApplicationArn arn1 = new ApplicationArn("a1"); ApplicationArn arn2 = new ApplicationArn("a2"); AWSCredentials mockCredentials = mock(AWSCredentials.class); DeletePlatformApplicationRequest r = new DeletePlatformApplicationRequestBuilder(arn1) .requestCredentials(mockCredentials) .platformApplicationArn(arn2) .getRequest(); assertEquals(mockCredentials, r.getRequestCredentials()); assertEquals(arn2.toString(), r.getPlatformApplicationArn()); }
@Test public void testNonInjectableMocks_shouldReturnNormal() { mockSns(new MockParameters()); CheckIfPhoneNumberIsOptedOutRequest phoneRequest = new CheckIfPhoneNumberIsOptedOutRequest() .withPhoneNumber("555123456"); CheckIfPhoneNumberIsOptedOutResult phoneResult = sns.checkIfPhoneNumberIsOptedOut(phoneRequest); assertNotNull(phoneResult); CreatePlatformApplicationRequest createPlatformRequest = new CreatePlatformApplicationRequest() .withAttributes(ImmutableMap.of("os","oreo")) .withName("android").withPlatform("mobile"); assertNotNull(sns.createPlatformApplication(createPlatformRequest)); CreatePlatformEndpointRequest createPlatformEndpointReq = new CreatePlatformEndpointRequest() .withAttributes(ImmutableMap.of("os","lollypop")) .withCustomUserData("something custom") .withPlatformApplicationArn("mobile") .withToken("5-euro-token"); assertNotNull(sns.createPlatformEndpoint(createPlatformEndpointReq)); DeleteEndpointRequest deleteEndpointReq = new DeleteEndpointRequest() .withEndpointArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e"); assertNotNull(sns.deleteEndpoint(deleteEndpointReq)); DeletePlatformApplicationRequest delPlatformAppReq = new DeletePlatformApplicationRequest() .withPlatformApplicationArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e"); assertNotNull(sns.deletePlatformApplication(delPlatformAppReq)); GetEndpointAttributesRequest getEndpointAttr = new GetEndpointAttributesRequest(); assertNotNull(sns.getEndpointAttributes(getEndpointAttr)); assertNotNull(sns.getPlatformApplicationAttributes( new GetPlatformApplicationAttributesRequest().withPlatformApplicationArn("some-arn"))); assertNotNull(sns.getSMSAttributes(new GetSMSAttributesRequest().withAttributes("attr1","attr2"))); assertNotNull(sns.listEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest() .withNextToken("0-euro-token").withPlatformApplicationArn("cheap-arn"))); assertNotNull(sns.listPhoneNumbersOptedOut(new ListPhoneNumbersOptedOutRequest().withNextToken("plastic-token"))); assertNotNull(sns.listPlatformApplications(new ListPlatformApplicationsRequest().withNextToken("wooden-token"))); assertNotNull(sns.listPlatformApplications()); assertNotNull(sns.optInPhoneNumber(new OptInPhoneNumberRequest().withPhoneNumber("123456789"))); assertNotNull(sns.setEndpointAttributes(new SetEndpointAttributesRequest().withEndpointArn("at the end of the world") .withAttributes(ImmutableMap.of("some-prop","some-value")))); assertNotNull(sns.setPlatformApplicationAttributes(new SetPlatformApplicationAttributesRequest().withPlatformApplicationArn("arnn:::") .withAttributes(ImmutableMap.of("super","mario")))); assertNotNull(sns.setSMSAttributes(new SetSMSAttributesRequest().withAttributes(ImmutableMap.of("wtf","mfg")))); assertNotNull(sns.removePermission(new RemovePermissionRequest().withLabel("fashion label").withTopicArn("fancy topic"))); }
private void deletePlatformApplication(String applicationArn) { DeletePlatformApplicationRequest request = new DeletePlatformApplicationRequest(); request.setPlatformApplicationArn(applicationArn); snsClient.deletePlatformApplication(request); }
@Override public void delete(DeletePlatformApplicationRequest request) { delete(request, null); }
@Override public void delete(DeletePlatformApplicationRequest request, ResultCapture<Void> extractor) { resource.performAction("Delete", request, extractor); }
public static void tearDown() { // delete application.delete(new DeletePlatformApplicationRequest()); }
public DeletePlatformApplicationRequest getRequest() { return request; }
/** * Performs the <code>Delete</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>PlatformApplication</code> resource, and any conflicting parameter * value set in the request will be overridden: * <ul> * <li> * <b><code>PlatformApplicationArn</code></b> * - mapped from the <code>Arn</code> identifier. * </li> * </ul> * * <p> * * @see DeletePlatformApplicationRequest */ void delete(DeletePlatformApplicationRequest request);
/** * Performs the <code>Delete</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>PlatformApplication</code> resource, and any conflicting parameter * value set in the request will be overridden: * <ul> * <li> * <b><code>PlatformApplicationArn</code></b> * - mapped from the <code>Arn</code> identifier. * </li> * </ul> * * <p> * * @see DeletePlatformApplicationRequest */ void delete(DeletePlatformApplicationRequest request, ResultCapture<Void> extractor);