Skip to content

Commit

Permalink
CAPP-10752 Test destructive delete with a document attached to the alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviv Murlakov committed Dec 23, 2018
1 parent 0a3e4e3 commit 983a36e
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.jboss.aerogear.unifiedpush.api.Alias;
import org.jboss.aerogear.unifiedpush.api.PushApplication;
import org.jboss.aerogear.unifiedpush.api.document.DocumentMetadata;
import org.jboss.aerogear.unifiedpush.service.annotations.LoggedInUser;
import org.jboss.aerogear.unifiedpush.service.impl.AliasServiceImpl.Associated;
import org.jboss.aerogear.unifiedpush.service.impl.spring.OAuth2Configuration;
Expand All @@ -40,6 +41,8 @@ public class AliasServiceTest extends AbstractCassandraServiceTest {

@Inject
private AliasService aliasService;
@Inject
private DocumentService documentService;

@Test
@Transactional
Expand Down Expand Up @@ -104,7 +107,8 @@ public void testRemoveAlias() throws IOException {
PushApplication pushApplication = new PushApplication();
UUID pushAppId = UUID.fromString(pushApplication.getPushApplicationID());

Alias[] legacyAliases = new Alias[] { new Alias(pushAppId, UUIDs.timeBased(), "Supprot@AeroGear.org"),
UUID firstGuid = UUIDs.timeBased();
Alias[] legacyAliases = new Alias[] { new Alias(pushAppId, firstGuid, "Supprot@AeroGear.org"),
new Alias(pushAppId, UUIDs.timeBased(), "Test@AeroGear.org"),
new Alias(pushAppId, UUIDs.timeBased(), "Help@AeroGear.org") };
List<Alias> aliasList = Arrays.asList(legacyAliases);
Expand All @@ -117,11 +121,14 @@ public void testRemoveAlias() throws IOException {
assertThat(aliasService.find(alias.getPushApplicationId(), alias.getId())).isNotNull();
});

documentService.save(new DocumentMetadata(pushAppId, getClass().getSimpleName(), firstGuid),
"doc1", "test_id");

// Delete alias
aliasService.remove(pushAppId, legacyAliases[0].getEmail());
aliasService.remove(pushAppId, firstGuid, true);

// Validate Alias is missing
assertThat(aliasService.find(legacyAliases[0].getPushApplicationId(), legacyAliases[0].getId())).isNull();
assertThat(aliasService.find(pushAppId, firstGuid)).isNull();

}

Expand Down

0 comments on commit 983a36e

Please sign in to comment.