-
Notifications
You must be signed in to change notification settings - Fork 154
Restructure Tests to distinguish between UnitTests and IntegrationTests #2258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
52149e4
excluded IntegrationsTests form UnitTests
christiangoerdes df6b1af
moved IntegrationTests
christiangoerdes 6f305c4
add to .gitignore
christiangoerdes ee1d07d
Merge branch 'master' into test-restructuring
christiangoerdes 4ea6b22
Extracted Long running Tests into separate Tests
christiangoerdes e378742
move majority of OAuth2Tests to integration tests
christiangoerdes 229bb40
move to integration tests
christiangoerdes d991b1d
Merge branch 'master' into test-restructuring
christiangoerdes 1029d54
Move OAuth2UtilTest to core.transport.ssl and remove B2C integration …
christiangoerdes d0cf713
Merge branch 'master' into test-restructuring
christiangoerdes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
52 changes: 52 additions & 0 deletions
52
...a/com/predic8/membrane/core/interceptor/oauth2/client/b2c/OAuth2ResourceB2CTestSetup.java
This file contains hidden or 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,52 @@ | ||
| /* | ||
| * Copyright 2016 predic8 GmbH, www.predic8.com | ||
| * 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 | ||
| * http://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 com.predic8.membrane.core.interceptor.oauth2.client.b2c; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.predic8.membrane.core.interceptor.oauth2.client.BrowserMock; | ||
| import com.predic8.membrane.core.interceptor.session.SessionManager; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| public abstract class OAuth2ResourceB2CTestSetup { | ||
| protected final Logger LOG = LoggerFactory.getLogger(OAuth2ResourceB2CTestSetup.class); | ||
| protected final B2CTestConfig tc = new B2CTestConfig(); | ||
| protected final ObjectMapper om = new ObjectMapper(); | ||
| protected final AtomicBoolean didLogIn = new AtomicBoolean(); | ||
| protected final AtomicBoolean didLogOut = new AtomicBoolean(); | ||
| protected final BrowserMock browser = new BrowserMock(); | ||
| protected final MockAuthorizationServer mockAuthorizationServer = new MockAuthorizationServer(tc, () -> didLogIn.set(true), () -> didLogOut.set(true)); | ||
| protected final B2CMembrane b2cMembrane = new B2CMembrane(tc, createSessionManager()); | ||
|
|
||
| @BeforeEach | ||
| void init() throws Exception { | ||
| didLogIn.set(false); | ||
| didLogOut.set(false); | ||
| mockAuthorizationServer.resetBehavior(); | ||
| mockAuthorizationServer.init(); | ||
| b2cMembrane.init(); | ||
| } | ||
|
|
||
| @AfterEach | ||
| void done() { | ||
| mockAuthorizationServer.stop(); | ||
| b2cMembrane.stop(); | ||
| } | ||
|
|
||
| protected abstract SessionManager createSessionManager(); | ||
| } | ||
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
core/src/test/java/com/predic8/membrane/integration/IntegrationTests.java
This file contains hidden or 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,12 @@ | ||
| package com.predic8.membrane.integration; | ||
|
|
||
| import org.junit.platform.suite.api.SelectClasses; | ||
| import org.junit.platform.suite.api.Suite; | ||
|
|
||
| @Suite | ||
| @SelectClasses({ | ||
| IntegrationTestsWithoutInternet.class, | ||
| IntegrationTestsWithInternet.class | ||
| }) | ||
| public class IntegrationTests { | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
11 changes: 11 additions & 0 deletions
11
...brane/integration/withoutinternet/interceptor/oauth2/InMemB2CResourceIntegrationTest.java
This file contains hidden or 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,11 @@ | ||
| package com.predic8.membrane.integration.withoutinternet.interceptor.oauth2; | ||
|
|
||
| import com.predic8.membrane.core.interceptor.session.InMemorySessionManager; | ||
| import com.predic8.membrane.core.interceptor.session.SessionManager; | ||
|
|
||
| public class InMemB2CResourceIntegrationTest extends OAuth2ResourceB2CIntegrationTest { | ||
| @Override | ||
| protected SessionManager createSessionManager() { | ||
| return new InMemorySessionManager(); | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
...embrane/integration/withoutinternet/interceptor/oauth2/JwtB2CResourceIntegrationTest.java
This file contains hidden or 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,10 @@ | ||
| package com.predic8.membrane.integration.withoutinternet.interceptor.oauth2; | ||
|
|
||
| import com.predic8.membrane.core.interceptor.session.SessionManager; | ||
|
|
||
| public class JwtB2CResourceIntegrationTest extends OAuth2ResourceB2CIntegrationTest { | ||
| @Override | ||
| protected SessionManager createSessionManager() { | ||
| return null; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.