This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated to match 1.2.2 * Updated Feature Gate for 1.1.2 * Fixed pom file indentation
- Loading branch information
Showing
68 changed files
with
1,603 additions
and
672 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>spring-cloud-azure</artifactId> | ||
<version>1.1.2-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>spring-cloud-azure-appconfiguration-config-web</artifactId> | ||
<name>Spring Cloud Azure App Configuration Config Web</name> | ||
<description>Integration of Spring Cloud Config and Azure App Configuration Service</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>spring-cloud-azure-appconfiguration-config</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-web</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
...ava/com/microsoft/azure/spring/cloud/config/web/AppConfigurationWebAutoConfiguration.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,27 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for | ||
* license information. | ||
*/ | ||
package com.microsoft.azure.spring.cloud.config.web; | ||
|
||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.cloud.endpoint.RefreshEndpoint; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.microsoft.azure.spring.cloud.config.AppConfigurationRefresh; | ||
|
||
@Configuration | ||
public class AppConfigurationWebAutoConfiguration { | ||
|
||
@Configuration | ||
@ConditionalOnClass(RefreshEndpoint.class) | ||
static class AppConfigurationWatchAutoConfiguration { | ||
|
||
@Bean | ||
public ConfigListener configListener(AppConfigurationRefresh appConfigurationRefresh) { | ||
return new ConfigListener(appConfigurationRefresh); | ||
} | ||
} | ||
} |
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
2 changes: 2 additions & 0 deletions
2
spring-cloud-azure-appconfiguration-config-web/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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
com.microsoft.azure.spring.cloud.config.web.AppConfigurationWebAutoConfiguration |
35 changes: 35 additions & 0 deletions
35
...com/microsoft/azure/spring/cloud/config/web/AppConfigurationWebAutoConfigurationTest.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,35 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for | ||
* license information. | ||
*/ | ||
package com.microsoft.azure.spring.cloud.config.web; | ||
|
||
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.CONN_STRING_PROP; | ||
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.STORE_ENDPOINT_PROP; | ||
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.TEST_CONN_STRING; | ||
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.TEST_STORE_NAME; | ||
import static com.microsoft.azure.spring.cloud.config.web.TestUtils.propPair; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.Test; | ||
import org.springframework.boot.autoconfigure.AutoConfigurations; | ||
import org.springframework.boot.test.context.runner.ApplicationContextRunner; | ||
|
||
import com.microsoft.azure.spring.cloud.config.AppConfigurationAutoConfiguration; | ||
import com.microsoft.azure.spring.cloud.config.AppConfigurationBootstrapConfiguration; | ||
|
||
public class AppConfigurationWebAutoConfigurationTest { | ||
private static final ApplicationContextRunner contextRunner = new ApplicationContextRunner() | ||
.withPropertyValues(propPair(CONN_STRING_PROP, TEST_CONN_STRING), | ||
propPair(STORE_ENDPOINT_PROP, TEST_STORE_NAME)) | ||
.withConfiguration(AutoConfigurations.of(AppConfigurationBootstrapConfiguration.class, | ||
AppConfigurationAutoConfiguration.class, AppConfigurationWebAutoConfiguration.class)); | ||
|
||
@Test | ||
public void watchEnabledNotConfiguredShouldNotCreateWatch() { | ||
contextRunner.run(context -> { | ||
assertThat(context).hasSingleBean(ConfigListener.class); | ||
}); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...n-config-web/src/test/java/com/microsoft/azure/spring/cloud/config/web/TestConstants.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,22 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for | ||
* license information. | ||
*/ | ||
package com.microsoft.azure.spring.cloud.config.web; | ||
|
||
/** | ||
* Test constants which can be shared across different test classes | ||
*/ | ||
public class TestConstants { | ||
private TestConstants() { | ||
} | ||
|
||
// Store specific configuration | ||
public static final String CONFIG_ENABLED_PROP = "spring.cloud.azure.appconfiguration.enabled"; | ||
public static final String CONN_STRING_PROP = "spring.cloud.azure.appconfiguration.stores[0].connection-string"; | ||
public static final String STORE_ENDPOINT_PROP = "spring.cloud.azure.appconfiguration.stores[0].endpoint"; | ||
public static final String TEST_CONN_STRING = | ||
"Endpoint=https://fake.test.config.io;Id=fake-conn-id;Secret=ZmFrZS1jb25uLXNlY3JldA=="; | ||
public static final String TEST_STORE_NAME = "store1"; | ||
} |
49 changes: 49 additions & 0 deletions
49
...ation-config-web/src/test/java/com/microsoft/azure/spring/cloud/config/web/TestUtils.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,49 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for | ||
* license information. | ||
*/ | ||
package com.microsoft.azure.spring.cloud.config.web; | ||
|
||
import java.util.List; | ||
|
||
import com.azure.data.appconfiguration.models.ConfigurationSetting; | ||
import com.microsoft.azure.spring.cloud.config.AppConfigurationProperties; | ||
import com.microsoft.azure.spring.cloud.config.stores.ConfigStore; | ||
|
||
/** | ||
* Utility methods which can be used across different test classes | ||
*/ | ||
public class TestUtils { | ||
private TestUtils() { | ||
} | ||
|
||
static String propPair(String propName, String propValue) { | ||
return String.format("%s=%s", propName, propValue); | ||
} | ||
|
||
static ConfigurationSetting createItem(String context, String key, String value, String label, String contentType) { | ||
ConfigurationSetting item = new ConfigurationSetting(); | ||
item.setKey(context + key); | ||
item.setValue(value); | ||
item.setLabel(label); | ||
item.setContentType(contentType); | ||
|
||
return item; | ||
} | ||
|
||
static void addStore(AppConfigurationProperties properties, String storeEndpoint, String connectionString) { | ||
addStore(properties, storeEndpoint, connectionString, null); | ||
} | ||
|
||
static void addStore(AppConfigurationProperties properties, String storeEndpoint, String connectionString, | ||
String label) { | ||
List<ConfigStore> stores = properties.getStores(); | ||
ConfigStore store = new ConfigStore(); | ||
store.setConnectionString(connectionString); | ||
store.setEndpoint(storeEndpoint); | ||
store.setLabel(label); | ||
stores.add(store); | ||
properties.setStores(stores); | ||
} | ||
} |
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.