-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1688 from hmcts/AM-3091_Remove_IDAM_Dependency_Co…
…ntract_Tests Am 3091 Remove IDAM Dependency from ORM Contract Tests
- Loading branch information
Showing
17 changed files
with
140 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/contractTest/java/uk/gov/hmcts/reform/orgrolemapping/BaseTestContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package uk.gov.hmcts.reform.orgrolemapping; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import org.springframework.context.ApplicationContextInitializer; | ||
import org.springframework.context.ApplicationListener; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.event.ContextClosedEvent; | ||
import org.springframework.lang.NonNull; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.support.TestPropertySourceUtils; | ||
import uk.gov.hmcts.reform.orgrolemapping.controller.BaseTest; | ||
import uk.gov.hmcts.reform.orgrolemapping.controller.utils.WiremockFixtures; | ||
|
||
@ContextConfiguration(initializers = {BaseTestContract.WireMockServerInitializer.class}) | ||
@ActiveProfiles("ctest") | ||
public abstract class BaseTestContract extends BaseTest { | ||
|
||
public static class WireMockServerInitializer | ||
implements ApplicationContextInitializer<ConfigurableApplicationContext> { | ||
|
||
private final WiremockFixtures wiremockFixtures = new WiremockFixtures(); | ||
|
||
@Override | ||
public void initialize(@NonNull ConfigurableApplicationContext applicationContext) { | ||
|
||
TestPropertySourceUtils.addInlinedPropertiesToEnvironment( | ||
applicationContext, | ||
"wiremock.server.port=" + WIRE_MOCK_SERVER.port() | ||
); | ||
|
||
try { | ||
wiremockFixtures.stubIdamConfig(); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
applicationContext.addApplicationListener((ApplicationListener<ContextClosedEvent>) event -> { | ||
if (WIRE_MOCK_SERVER.isRunning()) { | ||
WIRE_MOCK_SERVER.shutdown(); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
spring: | ||
security: | ||
oauth2: | ||
client: | ||
provider: | ||
oidc: | ||
issuer-uri: http://localhost:${wiremock.server.port:5000}/o | ||
|
||
idam: | ||
s2s-auth: | ||
url: http://localhost:${wiremock.server.port:4502} | ||
api.url: http://localhost:${wiremock.server.port:5000} | ||
|
||
feign: | ||
client: | ||
config: | ||
roleAssignmentApp: | ||
url: http://localhost:${wiremock.server.port:4096} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.