Skip to content

Commit 53ee39e

Browse files
Move appconfiguration to this repo (Azure#19305)
1 parent f721d22 commit 53ee39e

File tree

153 files changed

+9168
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+9168
-3
lines changed

eng/jacoco-test-coverage/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,11 @@
488488
<artifactId>azure-spring-cloud-messaging</artifactId>
489489
<version>2.2.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-messaging;current} -->
490490
</dependency>
491+
<dependency>
492+
<groupId>com.azure.spring</groupId>
493+
<artifactId>azure-spring-cloud-starter-appconfiguration-config</artifactId>
494+
<version>1.2.8-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-starter-appconfiguration-config;current} -->
495+
</dependency>
491496
<dependency>
492497
<groupId>com.azure.spring</groupId>
493498
<artifactId>azure-spring-cloud-starter-cache</artifactId>

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ com.azure.spring:azure-spring-cloud-appconfiguration-config-web;1.2.8-beta.1;1.2
112112
com.azure.spring:azure-spring-cloud-appconfiguration-config;1.2.8-beta.1;1.2.8-beta.1
113113
com.azure.spring:azure-spring-cloud-feature-management-web;1.2.8-beta.1;1.2.8-beta.1
114114
com.azure.spring:azure-spring-cloud-feature-management;1.2.8-beta.1;1.2.8-beta.1
115+
com.azure.spring:azure-spring-cloud-starter-appconfiguration-config;1.2.8-beta.1;1.2.8-beta.1
115116
com.azure.spring:azure-identity-spring;1.1.0;1.2.0-beta.1
116117
com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.1.0;3.2.0-beta.1
117118
com.azure.spring:azure-spring-boot-starter-active-directory;3.1.0;3.2.0-beta.1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Release History
2+
3+
## 1.2.8-beta.1 (Unreleased)
4+
### Breaking Changes
5+
- Change group id from `com.microsoft.azure` to `com.azure.spring`.
6+
- Change artifact id from `spring-cloud-azure-appconfiguration-config-web` to `azure-spring-cloud-appconfiguration-config-web`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Azure Spring cloud azure appconfiguration config web client library for Java
2+
3+
## Key concepts
4+
## Getting started
5+
## Key concepts
6+
## Examples
7+
## Troubleshooting
8+
## Next steps
9+
## Contributing
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>com.azure</groupId>
7+
<artifactId>azure-client-sdk-parent</artifactId>
8+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
9+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
13+
<groupId>com.azure.spring</groupId>
14+
<artifactId>azure-spring-cloud-appconfiguration-config-web</artifactId>
15+
<version>1.2.8-beta.1</version><!-- {x-version-update;com.azure.spring:azure-spring-cloud-appconfiguration-config-web;current} -->
16+
<name>Azure Spring Cloud App Configuration Config Web</name>
17+
<description>Integration of Spring Cloud Config and Azure App Configuration Service</description>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>com.azure.spring</groupId>
22+
<artifactId>azure-spring-cloud-appconfiguration-config</artifactId>
23+
<version>1.2.8-beta.1</version><!-- {x-version-update;com.azure.spring:azure-spring-cloud-appconfiguration-config;current} -->
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-web</artifactId>
28+
<version>2.3.5.RELEASE</version> <!-- {x-version-update;org.springframework.boot:spring-boot-starter-web;external_dependency} -->
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-actuator</artifactId>
33+
<version>2.3.5.RELEASE</version> <!-- {x-version-update;org.springframework.boot:spring-boot-starter-actuator;external_dependency} -->
34+
<optional>true</optional>
35+
<scope>compile</scope>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.springframework.cloud</groupId>
39+
<artifactId>spring-cloud-bus</artifactId>
40+
<version>2.2.3.RELEASE</version> <!-- {x-version-update;org.springframework.cloud:spring-cloud-bus;external_dependency} -->
41+
<optional>true</optional>
42+
<scope>compile</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>junit</groupId>
46+
<artifactId>junit</artifactId>
47+
<version>4.13.1</version> <!-- {x-version-update;junit:junit;external_dependency} -->
48+
<scope>test</scope>
49+
</dependency>
50+
<dependency>
51+
<groupId>org.mockito</groupId>
52+
<artifactId>mockito-core</artifactId>
53+
<version>3.3.3</version><!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
54+
<scope>test</scope>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-starter-test</artifactId>
59+
<version>2.3.5.RELEASE</version> <!-- {x-version-update;org.springframework.boot:spring-boot-starter-test;external_dependency} -->
60+
<scope>test</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.powermock</groupId>
64+
<artifactId>powermock-module-junit4</artifactId>
65+
<version>2.0.2</version> <!-- {x-version-update;org.powermock:powermock-module-junit4;external_dependency} -->
66+
<scope>test</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.powermock</groupId>
70+
<artifactId>powermock-api-mockito2</artifactId>
71+
<version>2.0.2</version> <!-- {x-version-update;org.powermock:powermock-api-mockito2;external_dependency} -->
72+
<scope>test</scope>
73+
</dependency>
74+
</dependencies>
75+
76+
<build>
77+
<plugins>
78+
<plugin>
79+
<groupId>org.apache.maven.plugins</groupId>
80+
<artifactId>maven-enforcer-plugin</artifactId>
81+
<version>3.0.0-M3</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
82+
<configuration>
83+
<rules>
84+
<bannedDependencies>
85+
<includes>
86+
<include>org.springframework.boot:spring-boot-starter-actuator:[2.3.5.RELEASE]</include> <!-- {x-include-update;org.springframework.boot:spring-boot-starter-actuator;external_dependency} -->
87+
<include>org.springframework.boot:spring-boot-starter-web:[2.3.5.RELEASE]</include> <!-- {x-include-update;org.springframework.boot:spring-boot-starter-web;external_dependency} -->
88+
<include>org.springframework.cloud:spring-cloud-bus:[2.2.3.RELEASE]</include> <!-- {x-include-update;org.springframework.cloud:spring-cloud-bus;external_dependency} -->
89+
</includes>
90+
</bannedDependencies>
91+
</rules>
92+
</configuration>
93+
</plugin>
94+
</plugins>
95+
</build>
96+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
package com.microsoft.azure.spring.cloud.config.web;
4+
5+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
6+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
7+
import org.springframework.cloud.endpoint.RefreshEndpoint;
8+
import org.springframework.context.annotation.Bean;
9+
import org.springframework.context.annotation.Configuration;
10+
11+
import com.microsoft.azure.spring.cloud.config.AppConfigurationRefresh;
12+
13+
@Configuration
14+
@ConditionalOnBean(AppConfigurationRefresh.class)
15+
public class AppConfigurationWebAutoConfiguration {
16+
17+
@Configuration
18+
@ConditionalOnClass(RefreshEndpoint.class)
19+
static class AppConfigurationWatchAutoConfiguration {
20+
21+
@Bean
22+
public ConfigListener configListener(AppConfigurationRefresh appConfigurationRefresh) {
23+
return new ConfigListener(appConfigurationRefresh);
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
package com.microsoft.azure.spring.cloud.config.web;
4+
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
import org.springframework.context.ApplicationListener;
8+
import org.springframework.stereotype.Component;
9+
import org.springframework.web.context.support.ServletRequestHandledEvent;
10+
11+
import com.microsoft.azure.spring.cloud.config.AppConfigurationRefresh;
12+
13+
@Component
14+
public class ConfigListener implements ApplicationListener<ServletRequestHandledEvent> {
15+
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigListener.class);
16+
17+
private AppConfigurationRefresh appConfigurationRefresh;
18+
19+
public ConfigListener(AppConfigurationRefresh appConfigurationRefresh) {
20+
this.appConfigurationRefresh = appConfigurationRefresh;
21+
}
22+
23+
@Override
24+
public void onApplicationEvent(ServletRequestHandledEvent event) {
25+
try {
26+
appConfigurationRefresh.refreshConfigurations();
27+
} catch (Exception e) {
28+
LOGGER.error("Refresh failed with unexpected exception.", e);
29+
}
30+
}
31+
32+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2+
com.microsoft.azure.spring.cloud.config.web.AppConfigurationWebAutoConfiguration
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
package com.microsoft.azure.spring.cloud.config.web;
4+
5+
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.CONN_STRING_PROP;
6+
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.STORE_ENDPOINT_PROP;
7+
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.TEST_CONN_STRING;
8+
import static com.microsoft.azure.spring.cloud.config.web.TestConstants.TEST_STORE_NAME;
9+
import static com.microsoft.azure.spring.cloud.config.web.TestUtils.propPair;
10+
import static org.assertj.core.api.Assertions.assertThat;
11+
12+
import org.junit.Test;
13+
import org.springframework.boot.autoconfigure.AutoConfigurations;
14+
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
15+
16+
import com.microsoft.azure.spring.cloud.config.AppConfigurationAutoConfiguration;
17+
import com.microsoft.azure.spring.cloud.config.AppConfigurationBootstrapConfiguration;
18+
19+
public class AppConfigurationWebAutoConfigurationTest {
20+
private static final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
21+
.withPropertyValues(propPair(CONN_STRING_PROP, TEST_CONN_STRING),
22+
propPair(STORE_ENDPOINT_PROP, TEST_STORE_NAME))
23+
.withConfiguration(AutoConfigurations.of(AppConfigurationBootstrapConfiguration.class,
24+
AppConfigurationAutoConfiguration.class, AppConfigurationWebAutoConfiguration.class));
25+
26+
@Test
27+
public void watchEnabledNotConfiguredShouldNotCreateWatch() {
28+
contextRunner.run(context -> {
29+
assertThat(context).hasSingleBean(ConfigListener.class);
30+
});
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
package com.microsoft.azure.spring.cloud.config.web;
4+
5+
/**
6+
* Test constants which can be shared across different test classes
7+
*/
8+
public class TestConstants {
9+
private TestConstants() {
10+
}
11+
12+
// Store specific configuration
13+
public static final String CONFIG_ENABLED_PROP = "spring.cloud.azure.appconfiguration.enabled";
14+
public static final String CONN_STRING_PROP = "spring.cloud.azure.appconfiguration.stores[0].connection-string";
15+
public static final String STORE_ENDPOINT_PROP = "spring.cloud.azure.appconfiguration.stores[0].endpoint";
16+
public static final String TEST_CONN_STRING =
17+
"Endpoint=https://fake.test.config.io;Id=fake-conn-id;Secret=ZmFrZS1jb25uLXNlY3JldA==";
18+
public static final String TEST_STORE_NAME = "store1";
19+
}

0 commit comments

Comments
 (0)