-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f4b79d
commit 4a4a3b9
Showing
17 changed files
with
152 additions
and
194 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
38 changes: 38 additions & 0 deletions
38
...loyment/src/test/java/io/quarkus/reactive/datasource/ChangingCredentialsProviderBase.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,38 @@ | ||
package io.quarkus.reactive.datasource; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.credentials.CredentialsProvider; | ||
|
||
public abstract class ChangingCredentialsProviderBase implements CredentialsProvider { | ||
|
||
private static final Logger log = Logger.getLogger(ChangingCredentialsProviderBase.class.getName()); | ||
|
||
private final String user2; | ||
private final String password2; | ||
|
||
private volatile Map<String, String> properties; | ||
|
||
protected ChangingCredentialsProviderBase(String user1, String password1, String user2, String password2) { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, user1); | ||
properties.put(PASSWORD_PROPERTY_NAME, password1); | ||
this.user2 = user2; | ||
this.password2 = password2; | ||
} | ||
|
||
public void changeProperties() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, user2); | ||
properties.put(PASSWORD_PROPERTY_NAME, password2); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getCredentials(String credentialsProviderName) { | ||
log.info("credentials provider returning " + properties); | ||
return properties; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
.../deployment/src/test/java/io/quarkus/reactive/datasource/ChangingCredentialsTestBase.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,36 @@ | ||
package io.quarkus.reactive.datasource; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
|
||
import org.hamcrest.CoreMatchers; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public abstract class ChangingCredentialsTestBase { | ||
|
||
private String user1; | ||
private String user2; | ||
|
||
protected ChangingCredentialsTestBase(String user1, String user2) { | ||
this.user1 = user1; | ||
this.user2 = user2; | ||
} | ||
|
||
@Test | ||
public void testConnect() throws Exception { | ||
given() | ||
.when().get("/test") | ||
.then() | ||
.statusCode(200) | ||
.body(CoreMatchers.equalTo(user1)); | ||
|
||
SECONDS.sleep(2); // sleep longer than pool idle connection timeout | ||
|
||
given() | ||
.when().get("/test") | ||
.then() | ||
.statusCode(200) | ||
.body(CoreMatchers.equalTo(user2)); | ||
} | ||
|
||
} |
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
29 changes: 3 additions & 26 deletions
29
...eployment/src/test/java/io/quarkus/reactive/mssql/client/ChangingCredentialsProvider.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 |
---|---|---|
@@ -1,36 +1,13 @@ | ||
package io.quarkus.reactive.mssql.client; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.credentials.CredentialsProvider; | ||
import io.quarkus.reactive.datasource.ChangingCredentialsProviderBase; | ||
|
||
@ApplicationScoped | ||
public class ChangingCredentialsProvider implements CredentialsProvider { | ||
|
||
private static final Logger log = Logger.getLogger(ChangingCredentialsProvider.class.getName()); | ||
|
||
private volatile Map<String, String> properties; | ||
public class ChangingCredentialsProvider extends ChangingCredentialsProviderBase { | ||
|
||
public ChangingCredentialsProvider() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "sa"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "A_Str0ng_Required_Password"); | ||
} | ||
|
||
public void changeProperties() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "user2"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "user2_Has_A_Str0ng_Required_Password"); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getCredentials(String credentialsProviderName) { | ||
log.info("credentials provider returning " + properties); | ||
return properties; | ||
super("sa", "A_Str0ng_Required_Password", "user2", "user2_Has_A_Str0ng_Required_Password"); | ||
} | ||
} |
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
29 changes: 3 additions & 26 deletions
29
...eployment/src/test/java/io/quarkus/reactive/mysql/client/ChangingCredentialsProvider.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 |
---|---|---|
@@ -1,36 +1,13 @@ | ||
package io.quarkus.reactive.mysql.client; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.credentials.CredentialsProvider; | ||
import io.quarkus.reactive.datasource.ChangingCredentialsProviderBase; | ||
|
||
@ApplicationScoped | ||
public class ChangingCredentialsProvider implements CredentialsProvider { | ||
|
||
private static final Logger log = Logger.getLogger(ChangingCredentialsProvider.class.getName()); | ||
|
||
private volatile Map<String, String> properties; | ||
public class ChangingCredentialsProvider extends ChangingCredentialsProviderBase { | ||
|
||
public ChangingCredentialsProvider() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "hibernate_orm_test"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "hibernate_orm_test"); | ||
} | ||
|
||
public void changeProperties() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "user2"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "user2"); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getCredentials(String credentialsProviderName) { | ||
log.info("credentials provider returning " + properties); | ||
return properties; | ||
super("hibernate_orm_test", "hibernate_orm_test", "user2", "user2"); | ||
} | ||
} |
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
29 changes: 3 additions & 26 deletions
29
...ployment/src/test/java/io/quarkus/reactive/oracle/client/ChangingCredentialsProvider.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 |
---|---|---|
@@ -1,36 +1,13 @@ | ||
package io.quarkus.reactive.oracle.client; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import io.quarkus.credentials.CredentialsProvider; | ||
import io.quarkus.reactive.datasource.ChangingCredentialsProviderBase; | ||
|
||
@ApplicationScoped | ||
public class ChangingCredentialsProvider implements CredentialsProvider { | ||
|
||
private static final Logger log = Logger.getLogger(ChangingCredentialsProvider.class.getName()); | ||
|
||
private volatile Map<String, String> properties; | ||
public class ChangingCredentialsProvider extends ChangingCredentialsProviderBase { | ||
|
||
public ChangingCredentialsProvider() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "SYSTEM"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "hibernate_orm_test"); | ||
} | ||
|
||
public void changeProperties() { | ||
properties = new HashMap<>(); | ||
properties.put(USER_PROPERTY_NAME, "user2"); | ||
properties.put(PASSWORD_PROPERTY_NAME, "user2"); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getCredentials(String credentialsProviderName) { | ||
log.info("credentials provider returning " + properties); | ||
return properties; | ||
super("SYSTEM", "hibernate_orm_test", "user2", "user2"); | ||
} | ||
} |
Oops, something went wrong.