Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Jan 2, 2025
1 parent 6d0093a commit d3ba455
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.formkiq.testutils.aws.FkqSsmService;
import software.amazon.awssdk.regions.Region;

import java.util.Map;

/**
*
* {@link ConfigService} configured specifically for FormKiQ.
Expand Down Expand Up @@ -77,11 +79,16 @@ public boolean save(final String siteId, final SiteConfiguration obj) {

@Override
public long increment(final String siteId, final String key) {
return 0;
return this.service.increment(siteId, key);
}

@Override
public long getIncrement(final String siteId, final String key) {
return 0;
return this.service.getIncrement(siteId, key);
}

@Override
public Map<String, Long> getIncrements(String siteId) {
return this.service.getIncrements(siteId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ public void testHandleGetSites01() throws Exception {
assertEquals(2, sites.size());

assertEquals(DEFAULT_SITE_ID, sites.get(0).getSiteId());
assertEquals("READ_WRITE", sites.get(0).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(0).getPermission());
assertEquals("ADMIN,DELETE,READ,WRITE", notNull(sites.get(0).getPermissions()).stream()
.map(Enum::name).collect(Collectors.joining(",")));
assertNotNull(sites.get(0).getUploadEmail());

String uploadEmail = sites.get(0).getUploadEmail();
assertNotNull(uploadEmail);
assertTrue(uploadEmail.endsWith("@tryformkiq.com"));
assertTrue(Pattern.matches(EMAIL, uploadEmail.subSequence(0, uploadEmail.indexOf("@"))));

Expand All @@ -114,9 +115,10 @@ public void testHandleGetSites01() throws Exception {
ssm.getParameterValue(String.format("/formkiq/ses/%s/%s", strs[1], strs[0])));

assertEquals("finance", sites.get(1).getSiteId());
assertEquals("READ_WRITE", sites.get(1).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(1).getPermission());
assertNotNull(sites.get(1).getUploadEmail());
uploadEmail = sites.get(1).getUploadEmail();
assertNotNull(uploadEmail);
assertTrue(uploadEmail.endsWith("@tryformkiq.com"));
assertTrue(Pattern.matches(EMAIL, uploadEmail.subSequence(0, uploadEmail.indexOf("@"))));
assertNotNull(ssm.getParameterValue(String.format("/formkiq/%s/siteid/%s/email",
Expand All @@ -141,14 +143,14 @@ public void testHandleGetSites02() throws Exception {
GetSitesResponse response = this.systemApi.getSites(null);

// then
List<Site> sites = response.getSites();
List<Site> sites = notNull(response.getSites());
assertEquals(2, sites.size());
assertEquals(DEFAULT_SITE_ID, sites.get(0).getSiteId());
assertEquals("READ_WRITE", sites.get(0).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(0).getPermission());
assertNull(sites.get(0).getUploadEmail());

assertEquals("finance", sites.get(1).getSiteId());
assertEquals("READ_WRITE", sites.get(1).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(1).getPermission());
assertNull(sites.get(1).getUploadEmail());
}

Expand All @@ -170,20 +172,21 @@ public void testHandleGetSites03() throws Exception {
GetSitesResponse response = this.systemApi.getSites(null);

// then
List<Site> sites = response.getSites();
List<Site> sites = notNull(response.getSites());

assertEquals(2, sites.size());
assertEquals(DEFAULT_SITE_ID, sites.get(0).getSiteId());
assertEquals("READ_ONLY", sites.get(0).getPermission().toString());
assertEquals(Site.PermissionEnum.ONLY, sites.get(0).getPermission());
assertNull(sites.get(0).getUploadEmail());

assertNull(ssm.getParameterValue(String.format("/formkiq/%s/siteid/%s/email",
FORMKIQ_APP_ENVIRONMENT, sites.get(0).getSiteId())));

assertEquals("finance", sites.get(1).getSiteId());
assertEquals("READ_WRITE", sites.get(1).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(1).getPermission());
assertNotNull(sites.get(1).getUploadEmail());
String uploadEmail = sites.get(1).getUploadEmail();
assertNotNull(uploadEmail);
assertTrue(uploadEmail.endsWith("@tryformkiq.com"));
assertTrue(Pattern.matches(EMAIL, uploadEmail.subSequence(0, uploadEmail.indexOf("@"))));
assertNotNull(ssm.getParameterValue(String.format("/formkiq/%s/siteid/%s/email",
Expand Down Expand Up @@ -212,11 +215,11 @@ public void testHandleGetSites04() throws Exception {
GetSitesResponse response = this.systemApi.getSites(null);

// then
List<Site> sites = response.getSites();
List<Site> sites = notNull(response.getSites());

assertEquals(1, sites.size());
assertEquals(siteId, sites.get(0).getSiteId());
assertEquals("READ_WRITE", sites.get(0).getPermission().toString());
assertEquals(Site.PermissionEnum.WRITE, sites.get(0).getPermission());
}

/**
Expand Down

0 comments on commit d3ba455

Please sign in to comment.