Skip to content

Commit

Permalink
refactor(GH-213): rename getSystemWorkspaceBuilder to getWorkspaceBui…
Browse files Browse the repository at this point in the history
…lder
  • Loading branch information
nicdard committed Jan 31, 2024
1 parent cf036b0 commit 2531fc9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ims/src/main/java/com/adobe/aio/util/WorkspaceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private WorkspaceUtil() {
* </ol>
* @return a Workspace.Builder loaded with the provided config
*/
public static Workspace.Builder getSystemWorkspaceBuilder() {
public static Workspace.Builder getWorkspaceBuilder() {
if (StringUtils.isNoneBlank(
System.getProperty(PrivateKeyBuilder.AIO_ENCODED_PKCS_8),
System.getProperty(Workspace.API_KEY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FeignImsServiceIntegrationTest {

@Test
public void getAndValidateJwtExchangeAccessToken() {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();
ImsService imsService = ImsService.builder().workspace(workspace).build();
AccessToken accessToken = imsService.getJwtExchangeAccessToken();
logger.info("JWT Exchange token flow complete");
Expand All @@ -41,28 +41,28 @@ public void getAndValidateJwtExchangeAccessToken() {

@Test
public void getAndValidateJwtExchangeAccessTokenWithBadApiKey() {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().apiKey("bad_api_key").build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().apiKey("bad_api_key").build();
ImsService imsService = ImsService.builder().workspace(workspace).build();
assertThrows(FeignException.BadRequest.class, imsService::getJwtExchangeAccessToken);
}

@Test
public void getAndValidateJwtExchangeAccessTokenWithBadSecret() {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().clientSecret("bad_secret").build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().clientSecret("bad_secret").build();
ImsService imsService = ImsService.builder().workspace(workspace).build();
assertThrows(FeignException.BadRequest.class, imsService::getJwtExchangeAccessToken);
}

@Test
public void getAndValidateJwtExchangeAccessTokenWithBadTechAccount() {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().technicalAccountId("bad_tech_account_id@techacct.adobe.com").build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().technicalAccountId("bad_tech_account_id@techacct.adobe.com").build();
ImsService imsService = ImsService.builder().workspace(workspace).build();
assertThrows(FeignException.BadRequest.class, imsService::getJwtExchangeAccessToken);
}

@Test
public void getAndValidateJwtExchangeAccessTokenWithMissingPrivateKey() {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().privateKey(null).build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().privateKey(null).build();
assertThrows(IllegalStateException.class, () -> ImsService.builder().workspace(workspace).build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void runTheReadmeFile() {

public static void main(String[] args) {
try {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();
ImsService imsService = ImsService.builder().workspace(workspace).build();

AccessToken accessToken = imsService.getJwtExchangeAccessToken();
Expand Down

0 comments on commit 2531fc9

Please sign in to comment.