Skip to content

Commit

Permalink
refactor(adobeGH-213): rename getSystemWorkspaceBuilder to getWorkspa…
Browse files Browse the repository at this point in the history
…ceBuilder
  • Loading branch information
nicdard committed Jan 31, 2024
1 parent cf036b0 commit 8f4162b
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FeignPublishServiceTestDrive {

public static void main(String[] args) {
try {
Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();
String providerId = WorkspaceUtil.getSystemProperty(AIO_PROVIDER_ID);
String eventCode = WorkspaceUtil.getSystemProperty(AIO_EVENT_CODE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FeignJournalServiceTestDrive {
public static void main(String[] args) {
try {

Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();
String journalUrl = WorkspaceUtil.getSystemProperty(AIO_JOURNAL_URL);
int nofEvents = 0;
int nofEntries = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FeignProviderServiceTestDrive {

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

ProviderService providerService = ProviderService.builder()
.workspace(workspace) // [1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class FeignRegistrationServiceTestDrive {
public static void main(String[] args) {
try {

Workspace workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
Workspace workspace = WorkspaceUtil.getWorkspaceBuilder().build();

RegistrationService registrationService = RegistrationService.builder()
.workspace(workspace) // [1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class JournalServiceTester {
private final Workspace workspace;

public JournalServiceTester() {
workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
workspace = WorkspaceUtil.getWorkspaceBuilder().build();
}

public boolean pollJournalForEvent(String journalUrl, String eventId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ProviderServiceTester {

public ProviderServiceTester() {
this.providerService = ProviderService.builder()
.workspace(WorkspaceUtil.getSystemWorkspaceBuilder().build())
.workspace(WorkspaceUtil.getWorkspaceBuilder().build())
.url(WorkspaceUtil.getSystemProperty(WorkspaceUtil.API_URL))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class RegistrationServiceTester {
protected final RegistrationService registrationService;

public RegistrationServiceTester() {
workspace = WorkspaceUtil.getSystemWorkspaceBuilder().build();
workspace = WorkspaceUtil.getWorkspaceBuilder().build();
registrationService = RegistrationService.builder()
.workspace(workspace)
.url(WorkspaceUtil.getSystemProperty(WorkspaceUtil.API_URL))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class PublishServiceTester {

public PublishServiceTester(){
publishService = PublishService.builder()
.workspace(WorkspaceUtil.getSystemWorkspaceBuilder().build())
.workspace(WorkspaceUtil.getWorkspaceBuilder().build())
.url(WorkspaceUtil.getSystemProperty(WorkspaceUtil.PUBLISH_URL))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void missingWorkspace() {
public void missingUrl() {
assertThrows(IllegalArgumentException.class, () ->
JournalService.builder()
.workspace(WorkspaceUtil.getSystemWorkspaceBuilder().build())
.workspace(WorkspaceUtil.getWorkspaceBuilder().build())
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void missingWorkspace() {
@Test
public void getProvidersWithInvalidConsumerOrgId() {
ProviderService providerService = ProviderService.builder()
.workspace(WorkspaceUtil.getSystemWorkspaceBuilder()
.workspace(WorkspaceUtil.getWorkspaceBuilder()
.consumerOrgId("invalid").build())
.url(WorkspaceUtil.getSystemProperty(WorkspaceUtil.API_URL))
.build();
Expand Down
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 8f4162b

Please sign in to comment.