-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore Format and CheckFormat for saml2 Projects
- Update the way that the saml2 projects were dependent on identity-provider resource files. - Use TestContainers to simplify runtime dependencies - Update compose.yml to use Docker-standard interpolation Closes gh-335
- Loading branch information
Showing
23 changed files
with
80 additions
and
337 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
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
70 changes: 0 additions & 70 deletions
70
...a/saml2/custom-urls/src/integTest/java/example/PreDockerComposeServerPortInitializer.java
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
servlet/spring-boot/java/saml2/custom-urls/src/integTest/resources/META-INF/spring.factories
This file was deleted.
Oops, something went wrong.
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
30 changes: 0 additions & 30 deletions
30
...er/src/main/java/example/ComposeFilePropertyPlaceholderApplicationContextInitializer.java
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
...pring-boot/java/saml2/identity-provider/src/main/java/example/DockerProtocolResolver.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
.../saml2/identity-provider/src/main/java/example/IdentityProviderTestExecutionListener.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,53 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package example; | ||
|
||
import java.io.IOException; | ||
import java.net.ServerSocket; | ||
|
||
import org.testcontainers.containers.DockerComposeContainer; | ||
|
||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.test.context.TestContext; | ||
import org.springframework.test.context.support.AbstractTestExecutionListener; | ||
|
||
public class IdentityProviderTestExecutionListener extends AbstractTestExecutionListener { | ||
|
||
private DockerComposeContainer<?> composed; | ||
|
||
@Override | ||
public void beforeTestClass(TestContext testContext) throws Exception { | ||
String port = Integer.toString(getRandomPort()); | ||
System.setProperty("SERVER_PORT", port); | ||
System.setProperty("server.port", port); | ||
this.composed = new DockerComposeContainer<>("saml2", new ClassPathResource("docker/compose.yml").getFile()) | ||
.withEnv("SERVER_PORT", port); | ||
this.composed.start(); | ||
} | ||
|
||
@Override | ||
public void afterTestClass(TestContext testContext) throws Exception { | ||
this.composed.stop(); | ||
} | ||
|
||
static int getRandomPort() throws IOException { | ||
try (ServerSocket serverSocket = new ServerSocket(0)) { | ||
return serverSocket.getLocalPort(); | ||
} | ||
} | ||
|
||
} |
3 changes: 1 addition & 2 deletions
3
...let/spring-boot/java/saml2/identity-provider/src/main/resources/META-INF/spring.factories
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
org.springframework.context.ApplicationContextInitializer=example.ComposeFilePropertyPlaceholderApplicationContextInitializer | ||
org.springframework.core.io.ProtocolResolver=example.DockerProtocolResolver | ||
org.springframework.test.context.TestExecutionListener=example.IdentityProviderTestExecutionListener |
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.