diff --git a/eng/code-quality-reports/src/main/resources/revapi/revapi.json b/eng/code-quality-reports/src/main/resources/revapi/revapi.json index b912628285e7..c836eb9c7ed8 100644 --- a/eng/code-quality-reports/src/main/resources/revapi/revapi.json +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -92,7 +92,7 @@ "class com\\.azure\\.spring\\.cloud\\.config\\.web\\.AppConfigurationEndpoint", { "matcher": "java-package", - "match": "/org\\.apache\\.avro(\\..*)?/" + "match": "/org\\.apache\\.(avro|commons|qpid)(\\..*)?/" }, { "matcher": "java-package", @@ -100,19 +100,7 @@ }, { "matcher": "java-package", - "match": "/org\\.junit(\\..*)?/" - }, - { - "matcher": "java-package", - "match": "/org.apache.commons(..*)?/" - }, - { - "matcher": "java-package", - "match": "/org.slf4j(..*)?/" - }, - { - "matcher": "java-package", - "match": "/org.springframework(..*)?/" + "match": "/org\\.(junit|slf4j|springframework)(\\..*)?/" } ] } @@ -249,6 +237,21 @@ "superClass": "com.azure.core.models.MessageContent", "justification": "To support Schema Registry Avro Serializer's signature, EventData extends from MessageContent." }, + { + "code": "java.method.visibilityReduced", + "new": "method com.azure.spring.cloud.autoconfigure.context.AzureTokenCredentialAutoConfiguration.AzureServiceClientBuilderFactoryPostProcessor com.azure.spring.cloud.autoconfigure.context.AzureTokenCredentialAutoConfiguration::builderFactoryBeanPostProcessor()", + "justification": "Shouldn't have been a public API and was recently released." + }, + { + "code": "java.method.visibilityReduced", + "new": "method com.azure.spring.cloud.autoconfigure.jms.AzureServiceBusJmsPropertiesBeanPostProcessor com.azure.spring.cloud.autoconfigure.jms.ServiceBusJmsAutoConfiguration::azureServiceBusJmsPropertiesBeanPostProcessor(org.springframework.beans.factory.ObjectProvider>)", + "justification": "Shouldn't have been a public API and was recently released." + }, + { + "code": "java.annotation.added", + "new": "class com.azure.spring.cloud.autoconfigure.context.AzureTokenCredentialAutoConfiguration", + "justification": "Fixes a bug." + }, { "code": "java.missing.newSuperType", "old": "class com.azure.messaging.eventhubs.EventData", diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 57eda89aa913..ac2e89f7b000 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -52,6 +52,9 @@ parameters: - name: TestParallelization type: string default: '1C' + - name: JavaBuildVersion + type: string + default: $(JavaBuildVersion) jobs: - job: 'Build' @@ -172,14 +175,14 @@ jobs: displayName: 'pip install markdown2 and BeautifulSoup4' - task: Maven@3 - displayName: 'Build and Package, JDK Version: $(JavaBuildVersion)' + displayName: 'Build and Package, JDK Version: ${{ parameters.JavaBuildVersion }}' inputs: mavenPomFile: pom.xml goals: 'deploy' options: '$(DefaultOptions) -T ${{parameters.BuildParallelization}} ${{parameters.AdditionalBuildOptions}} -DskipTests -Dgenerate-overview -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -pl $(ProjectList) -am -DaltDeploymentRepository=id::default::file://$(System.DefaultWorkingDirectory)/build' # We include template-module so we ensure it always builds in CI mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' - jdkVersionOption: $(JavaBuildVersion) + jdkVersionOption: ${{ parameters.JavaBuildVersion }} jdkArchitectureOption: 'x64' publishJUnitResults: false @@ -340,6 +343,8 @@ jobs: # We `install` the code quality reports tooling into our local m2 cache separately from building the Maven project # reports. This means it is available as part of that, but also so that this is not documented in the project report. - template: ../steps/install-reporting-tools.yml + parameters: + JdkVersion: ${{ parameters.JavaBuildVersion }} # maven dependency:tree needs to be able to resolve dependencies, so these should be installed. - task: Maven@3 @@ -350,7 +355,7 @@ jobs: options: '$(DefaultOptions) -T ${{parameters.BuildParallelization}} ${{parameters.AdditionalBuildOptions}} -DskipTests $(DefaultSkipOptions) -pl $(ProjectList) -am' mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' - jdkVersionOption: $(JavaBuildVersion) + jdkVersionOption: ${{ parameters.JavaBuildVersion }} jdkArchitectureOption: 'x64' publishJUnitResults: false @@ -361,7 +366,7 @@ jobs: options: '$(DefaultOptions) --no-transfer-progress -DskipTests -Dgpg.skip -Dverify-readme -DskipCompile=true -DskipTestCompile=true ${{ parameters.AdditionalLintingOptions }} -pl $(ProjectList)' mavenOptions: '$(MemoryOptions)' javaHomeOption: 'JDKVersion' - jdkVersionOption: $(JavaBuildVersion) + jdkVersionOption: ${{ parameters.JavaBuildVersion }} jdkArchitectureOption: 'x64' publishJUnitResults: false goals: 'verify' diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index ed74d56d6dc2..948ebed4133e 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -56,6 +56,9 @@ parameters: - name: EnableBatchRelease type: boolean default: false +- name: JavaBuildVersion + type: string + default: $(JavaBuildVersion) stages: - stage: Build @@ -84,11 +87,16 @@ stages: - ${{ replacement }} - AZURE_TEST.*=.*/ + - ${{ if eq(parameters.SDKType, 'data') }}: + - JavaTestVersion=(.*1)\.17(.*)/$1.11$2 PreBuildSteps: ${{ parameters.PreBuildSteps }} AdditionalLintingOptions: ${{ parameters.AdditionalLintingOptions }} ${{ if eq(parameters.SDKType, 'data') }}: TestGoals: 'verify' TestOptions: '-am' + JavaBuildVersion: '1.11' + ${{ else }}: + JavaBuildVersion: ${{ parameters.JavaBuildVersion }} - ${{ parameters.AdditionalStagesAfterBuild }} diff --git a/eng/pipelines/templates/stages/archetype-sdk-tests.yml b/eng/pipelines/templates/stages/archetype-sdk-tests.yml index 381859e29875..fed4414d18de 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-tests.yml @@ -104,6 +104,9 @@ parameters: - name: AdditionalBuildOptions type: string default: $(AdditionalBuildOptions) +- name: LtsVersion + type: string + default: $(JavaTestVersion) stages: - ${{ each cloud in parameters.CloudConfig }}: diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index 470f576d35a4..3f2c007150b2 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -41,6 +41,7 @@ stages: - TestFromSource=^$|false MatrixReplace: - AZURE_TEST.*=.*/ + - JavaTestVersion=(.*1)\.17(.*)/$1.11$2 BuildParallelization: 1 AdditionalBuildOptions: '-DsparkShading' TestOptions: '-Punit' @@ -57,6 +58,8 @@ stages: Path: eng/pipelines/templates/stages/cosmos-emulator-matrix.json Selection: all GenerateVMJobs: true + MatrixReplace: + - JavaTestVersion=(.*1)\.17(.*)/$1.11$2 AdditionalParameters: BuildParallelization: 1 AdditionalBuildOptions: '-DsparkShading' diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index 5c539403e783..9a8abb1c3b33 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -8,7 +8,7 @@ "windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" }, "macOS-10.15": { "OSVmImage": "macOS-10.15", "Pool": "Azure Pipelines" } }, - "JavaTestVersion": [ "1.8", "1.11" ], + "JavaTestVersion": [ "1.8", "1.17" ], "AZURE_TEST_HTTP_CLIENTS": [ "okhttp", "netty" ], "TestFromSource": false, "TestGoals": "surefire:test", @@ -17,7 +17,7 @@ "exclude": [ { "Pool": "azsdk-pool-mms-win-2019-general", - "JavaTestVersion": "1.11" + "JavaTestVersion": "1.17" } ], "include": [ @@ -25,7 +25,7 @@ "Agent": { "ubuntu-20.04": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } }, - "JavaTestVersion": "1.11", + "JavaTestVersion": "1.17", "AZURE_TEST_HTTP_CLIENTS": "netty", "TestFromSource": true, "TestGoals": "verify", @@ -35,11 +35,21 @@ "Agent": { "windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" } }, - "JavaTestVersion": "1.11", + "JavaTestVersion": "1.17", "AZURE_TEST_HTTP_CLIENTS": "netty", "TestFromSource": false, "TestGoals": "verify", "TestOptions": "-DskipCompile=true -DskipTestCompile=true -DcreateSourcesJar=false" + }, + { + "Agent": { + "ubuntu-20.04": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } + }, + "JavaTestVersion": "1.11", + "AZURE_TEST_HTTP_CLIENTS": "netty", + "TestFromSource": false, + "TestGoals": "surefire:test", + "TestOptions": "" } ] } diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index 440c836cffd0..dd295ac4b0fa 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -1,9 +1,9 @@ variables: DocWardenVersion: '0.7.1' # This is the default Java build version. It's the version used to build the shipping libraries, Spotbugs etc. - JavaBuildVersion: '1.11' + JavaBuildVersion: '1.17' # This is the default Java test version. It's the version used when running tests. - JavaTestVersion: '1.11' + JavaTestVersion: '1.17' # True if 'Enable system diagnostics' is checked when running a pipeline manually IsDebug: $[coalesce(variables['System.Debug'], 'false')] diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config-web/src/main/java/com/azure/spring/cloud/config/web/AppConfigurationWebConstants.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config-web/src/main/java/com/azure/spring/cloud/config/web/AppConfigurationWebConstants.java index bac12c1c5a06..4dc3bd98f8dc 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config-web/src/main/java/com/azure/spring/cloud/config/web/AppConfigurationWebConstants.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config-web/src/main/java/com/azure/spring/cloud/config/web/AppConfigurationWebConstants.java @@ -25,7 +25,7 @@ public final class AppConfigurationWebConstants { * Json field name for SyncToken value */ public static final String SYNC_TOKEN = "syncToken"; - + /** * Prefix of the validation code. */ diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationCredentialProvider.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationCredentialProvider.java index 2698804809cb..41f6b46de708 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationCredentialProvider.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationCredentialProvider.java @@ -5,7 +5,8 @@ import com.azure.core.credential.TokenCredential; /** - * Interface to be implemented that enables returning of a TokenCredential for authentication with an Azure App Configuration stores. + * Interface to be implemented that enables returning of a TokenCredential for authentication with an Azure App + * Configuration stores. */ public interface AppConfigurationCredentialProvider { diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocator.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocator.java index 4304e6de992f..ebd7cc378372 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocator.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocator.java @@ -57,7 +57,7 @@ public final class AppConfigurationPropertySourceLocator implements PropertySour private static final AtomicBoolean configloaded = new AtomicBoolean(false); - private static final AtomicBoolean startup = new AtomicBoolean(true); + static final AtomicBoolean startup = new AtomicBoolean(true); /** * Loads all Azure App Configuration Property Sources configured. @@ -95,7 +95,7 @@ public PropertySource locate(Environment environment) { List profiles = Arrays.asList(env.getActiveProfiles()); CompositePropertySource composite = new CompositePropertySource(PROPERTY_SOURCE_NAME); - Collections.reverse(configStores); // Last store has highest precedence + Collections.reverse(configStores); // Last store has the highest precedence Iterator configStoreIterator = configStores.iterator(); // Feature Management needs to be set in the last config store. @@ -131,9 +131,7 @@ public PropertySource locate(Environment environment) { * * @param composite PropertySource being added * @param store Config Store the PropertySource is being generated from - * @param applicationName Name of the application * @param profiles Active profiles in the Store - * @param storeContextsMap the Map storing the storeName -> List of contexts map * @param initFeatures determines if Feature Management is set in the PropertySource. When generating more than one * it needs to be in the last one. */ @@ -182,11 +180,9 @@ private void addPropertySource(CompositePropertySource composite, ConfigStore st } /** - * Creates a new set of AppConfigurationProertySources, 1 per Label. + * Creates a new set of AppConfigurationPropertySources, 1 per Label. * - * @param context Context of the application, part of uniquely define a PropertySource * @param store Config Store the PropertySource is being generated from - * @param storeContextsMap the Map storing the storeName -> List of contexts map * @param initFeatures determines if Feature Management is set in the PropertySource. When generating more than one * it needs to be in the last one. * @return a list of AppConfigurationPropertySources diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationRefresh.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationRefresh.java index 178148823015..4ef8bf42d2e5 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationRefresh.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/AppConfigurationRefresh.java @@ -33,7 +33,6 @@ /** * Enables checking of Configuration updates. - * */ @Component public class AppConfigurationRefresh implements ApplicationEventPublisherAware { @@ -58,7 +57,7 @@ public class AppConfigurationRefresh implements ApplicationEventPublisherAware { /** * Component used for checking for and triggering configuration refreshes. - * + * * @param properties Client properties to check against. * @param appProperties Library properties for configuring backoff * @param clientStore Clients stores used to connect to App Configuration. @@ -304,7 +303,7 @@ private boolean refreshFeatureFlags(ConfigStore configStore, State state, String /** * Gets latest Health connection info for refresh. - * + * * @return Map of String, endpoint, and Health information. */ public Map getAppConfigurationStoresHealth() { diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/StateHolder.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/StateHolder.java index e959f3e9c3b7..c7a587a53189 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/StateHolder.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/StateHolder.java @@ -121,7 +121,7 @@ public static Instant getNextForcedRefresh() { /** * Set after load or refresh is successful. - * @param nextForcedRefresh the nextForcedRefresh to set + * @param refreshPeriod the refreshPeriod to set */ public static void setNextForcedRefresh(Duration refreshPeriod) { nextForcedRefresh = Instant.now().plusSeconds(refreshPeriod.getSeconds()); @@ -130,7 +130,7 @@ public static void setNextForcedRefresh(Duration refreshPeriod) { /** * Sets a minimum value until the next refresh. If a refresh interval has passed or is smaller than the calculated * backoff time, the refresh interval is set to the backoff time. - * @param refreshInterval period between refreshe checks. + * @param refreshInterval period between refresh checks. * @param properties Provider properties for min and max backoff periods. */ static void updateNextRefreshTime(Duration refreshInterval, AppConfigurationProviderProperties properties) { @@ -156,7 +156,7 @@ static void updateNextRefreshTime(Duration refreshInterval, AppConfigurationProv STATE.put(entry.getKey(), updatedState); } } - + /** * Calculates the amount of time to the next refresh, if a refresh fails. Takes current Refresh date into account * for watch keys. Used for checking client refresh-interval only. diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/properties/AppConfigurationProperties.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/properties/AppConfigurationProperties.java index 822681b2518e..8fb586191753 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/properties/AppConfigurationProperties.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/properties/AppConfigurationProperties.java @@ -28,7 +28,7 @@ public final class AppConfigurationProperties { /** - * Prefix for client configurations for connecting to stores. + * Prefix for client configurations for connecting to configuration stores. */ public static final String CONFIG_PREFIX = "spring.cloud.azure.appconfiguration"; @@ -98,7 +98,7 @@ public String getDefaultContext() { } /** - * Overrides the default context of `applicaiton`. + * Overrides the default context of `application`. * @deprecated Use spring.cloud.azure.appconfiguration[0].selects * @param defaultContext Key Prefix. */ @@ -121,7 +121,7 @@ public String getName() { /** * Used to override the spring.application.name value * @deprecated Use spring.cloud.azure.appconfiguration[0].selects - * @param name application name in conifg key. + * @param name application name in config key. */ @Deprecated public void setName(@Nullable String name) { diff --git a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/test/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocatorTest.java b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/test/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocatorTest.java index 02bc2361e321..eeb036b51e01 100644 --- a/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/test/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocatorTest.java +++ b/sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/test/java/com/azure/spring/cloud/config/AppConfigurationPropertySourceLocatorTest.java @@ -19,20 +19,19 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -71,7 +70,7 @@ public class AppConfigurationPropertySourceLocatorTest { private static final String PROFILE_NAME_1 = "dev"; private static final String PROFILE_NAME_2 = "prod"; - + private static final String KEY_FILTER = "/foo/"; private static final ConfigurationSetting FEATURE_ITEM = createItem(".appconfig.featureflag/", "Alpha", @@ -167,9 +166,10 @@ public Object getProperty(String name) { when(emptyEnvironment.getPropertySources()).thenReturn(sources); when(devEnvironment.getPropertySources()).thenReturn(sources); when(multiEnvironment.getPropertySources()).thenReturn(sources); - + when(properties.getStores()).thenReturn(configStoresMock); when(properties.isEnabled()).thenReturn(true); + when(properties.getRefreshInterval()).thenReturn(null); when(configStoresMock.iterator()).thenReturn(configStoreIterator); when(configStoreIterator.hasNext()).thenReturn(true).thenReturn(false); when(configStoreIterator.next()).thenReturn(configStoreMock); @@ -210,12 +210,7 @@ public Object getProperty(String name) { @AfterEach public void cleanup() throws Exception { MockitoAnnotations.openMocks(this).close(); - Field field = AppConfigurationPropertySourceLocator.class.getDeclaredField("startup"); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.setAccessible(true); - field.set(null, new AtomicBoolean(true)); + AppConfigurationPropertySourceLocator.startup.set(true); StateHolder.setLoadState(TEST_STORE_NAME, false); } @@ -356,23 +351,17 @@ public void defaultFailFastThrowException() throws IOException { } @Test - public void refreshThrowException() throws IOException, NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException { - Field field = AppConfigurationPropertySourceLocator.class.getDeclaredField("startup"); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.setAccessible(true); - field.set(null, new AtomicBoolean(false)); + public void refreshThrowException() throws IOException, IllegalArgumentException { + AppConfigurationPropertySourceLocator.startup.set(false); StateHolder.setLoadState(TEST_STORE_NAME, true); locator = new AppConfigurationPropertySourceLocator(properties, appProperties, clientStoreMock, tokenCredentialProvider, null, null); when(clientStoreMock.getWatchKey(Mockito.any(), Mockito.anyString(), Mockito.anyString())).thenThrow(new RuntimeException()); + when(clientStoreMock.getFeatureFlagWatchKey(any(), anyString())).thenThrow(new RuntimeException()); RuntimeException e = assertThrows(RuntimeException.class, () -> locator.locate(emptyEnvironment)); assertNull(e.getMessage()); - assertNull(e.getMessage()); } @Test diff --git a/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureHandler.java b/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureHandler.java index f2dd4cef95ac..27816c7b0e52 100644 --- a/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureHandler.java +++ b/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureHandler.java @@ -33,9 +33,9 @@ public class FeatureHandler extends HandlerInterceptorAdapter { private IDisabledFeaturesHandler disabledFeaturesHandler; /** - * Intercepter for Requests to check if they should be run. + * Interceptor for Requests to check if they should be run. * @param featureManager App Configuration Feature Manager - * @param featureManagerSnapshot App Configuraiton Feature Manager snapshot version + * @param featureManagerSnapshot App Configuration Feature Manager snapshot version * @param disabledFeaturesHandler optional handler for dealing with disabled endpoints. */ public FeatureHandler(FeatureManager featureManager, FeatureManagerSnapshot featureManagerSnapshot, diff --git a/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureManagementWebConfiguration.java b/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureManagementWebConfiguration.java index 93711f0f4770..849a89e49d80 100644 --- a/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureManagementWebConfiguration.java +++ b/sdk/appconfiguration/azure-spring-cloud-feature-management-web/src/main/java/com/azure/spring/cloud/feature/manager/FeatureManagementWebConfiguration.java @@ -43,7 +43,7 @@ public FeatureHandler featureHandler(FeatureManager featureManager, FeatureManag /** * Creates FeatureConfig - * @param featureHandler Intercepter for requests to check if then need to be blocked/redirected. + * @param featureHandler Interceptor for requests to check if then need to be blocked/redirected. * @return FeatureConfig */ @Bean diff --git a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml index b847baa27768..9112fe1ec675 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml @@ -40,6 +40,7 @@ false + 3.2 diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml index fb31f31b8d97..7165fdeb6cfe 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml @@ -35,6 +35,8 @@ true ${cosmos.spark.skip} ${cosmos.spark.skip} + + 3.1 @@ -380,6 +382,9 @@ scalatest-maven-plugin 2.0.2 + + ${cosmos-spark-version} + ${project.build.directory}/surefire-reports . SparkTestSuite.txt diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosRowConverterSpec.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosRowConverterSpec.scala index 22bba2ff8c44..f44d1c2d7f54 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosRowConverterSpec.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosRowConverterSpec.scala @@ -10,7 +10,7 @@ import org.apache.spark.sql.catalyst.CatalystTypeConverters.convertToCatalyst import org.apache.spark.sql.catalyst.{CatalystTypeConverters, InternalRow} import org.apache.spark.sql.catalyst.util.ArrayData import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder -import org.apache.spark.sql.catalyst.expressions.{GenericRowWithSchema, Uuid} +import org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema import java.sql.{Date, Timestamp} import java.time.format.DateTimeFormatter @@ -291,6 +291,9 @@ class CosmosRowConverterSpec extends UnitSpec with BasicLoggingTrait { } "array in spark row" should "translate to ObjectNode" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val colName1 = "testCol1" val colName2 = "testCol2" val colName3 = "testCol3" @@ -464,6 +467,9 @@ class CosmosRowConverterSpec extends UnitSpec with BasicLoggingTrait { } "date and time in spark row" should "should honor dateTimeConversionMode config" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val colName1 = "testCol1" val colName2 = "testCol2" @@ -1006,6 +1012,9 @@ class CosmosRowConverterSpec extends UnitSpec with BasicLoggingTrait { } "null for decimal in ObjectNode" should "should not throw when nullable" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val colName1 = "testCol1" val colVal1 = "" @@ -1027,6 +1036,9 @@ class CosmosRowConverterSpec extends UnitSpec with BasicLoggingTrait { } "null for decimal in ObjectNode" should "should throw when not nullable" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val colName1 = "testCol1" val colVal1 = "" diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosTableSchemaInferrerSpec.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosTableSchemaInferrerSpec.scala index ae57d64efb83..525c95211f7c 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosTableSchemaInferrerSpec.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/CosmosTableSchemaInferrerSpec.scala @@ -3,12 +3,10 @@ package com.azure.cosmos.spark import com.fasterxml.jackson.databind.ObjectMapper - import com.fasterxml.jackson.databind.node.ObjectNode -import org.apache.spark.sql.types.{ - ArrayType, BinaryType, BooleanType, DecimalType, DoubleType, - FloatType, LongType, NullType, StringType, StructType, IntegerType, StructField -} +import org.apache.spark.sql.types.{ArrayType, BinaryType, BooleanType, DecimalType, DoubleType, FloatType, IntegerType, LongType, NullType, StringType, StructField, StructType} + +import scala.language.postfixOps class CosmosTableSchemaInferrerSpec extends UnitSpec { //scalastyle:off null @@ -175,6 +173,8 @@ class CosmosTableSchemaInferrerSpec extends UnitSpec { } "nested array properties" should "handle different schema elements" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) val jsonText = "{ \"Actions\": " + "[{ \"Condition\": [] }," + @@ -301,6 +301,9 @@ class CosmosTableSchemaInferrerSpec extends UnitSpec { } it should "map nested objects properties when objects have different properties" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val nodeValue = 10 val objectNode: ObjectNode = objectMapper.createObjectNode() val subNode = objectNode.putObject("id") diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/RowSerializerPollSpec.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/RowSerializerPollSpec.scala index 257923580d91..73db4a2b775a 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/RowSerializerPollSpec.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/RowSerializerPollSpec.scala @@ -10,6 +10,9 @@ class RowSerializerPollSpec extends UnitSpec with BasicLoggingTrait { //scalastyle:off multiple.string.literals "RowSerializer returned to the pool" should "be reused when capacity not exceeded" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val schema = StructType(Seq(StructField("column_A", IntegerType), StructField("column_B", StringType))) val sameSchema = StructType(Seq(StructField("column_A", IntegerType), StructField("column_B", StringType))) @@ -24,6 +27,9 @@ class RowSerializerPollSpec extends UnitSpec with BasicLoggingTrait { } "RowSerializer " should "be returned to the pool only a limited number of times" in { + val canRun = Platform.canRunTestAccessingDirectByteBuffer + assume(canRun._1, canRun._2) + val schema = StructType(Seq(StructField("column01", IntegerType), StructField("column02", StringType))) for (_ <- 1 to 256) { diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/TestUtils.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/TestUtils.scala index 69f281cfb914..adbe8259bec1 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/TestUtils.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/TestUtils.scala @@ -272,4 +272,16 @@ object Platform { def isWindows: Boolean = { System.getProperty("os.name").toLowerCase.contains("win") } + + // Indicates whether a test is capable of running when it attempts to access DirectByteBuffer via reflection. + // Spark 3.1 was written in a way where it attempts to access DirectByteBuffer illegally via reflection in Java 16+. + def canRunTestAccessingDirectByteBuffer: (Boolean, Any) = { + val hasSparkVersion = util.Properties.propIsSet("cosmos-spark-version") + val sparkVersion = util.Properties.propOrElse("cosmos-spark-version", "unknown") + + (!util.Properties.isJavaAtLeast("16") || (hasSparkVersion && !sparkVersion.equals("3.1")), + s"Test was skipped as it will attempt to reflectively access DirectByteBuffer while using JVM version ${util.Properties.javaSpecVersion} and Spark version $sparkVersion. " + + "These versions used together will result in an InaccessibleObjectException due to JVM changes on how internal APIs can be accessed by reflection," + + " and the Spark version, or unknown version, attempts to access DirectByteBuffer via reflection.") + } } \ No newline at end of file diff --git a/sdk/cosmos/integration-matrix.json b/sdk/cosmos/integration-matrix.json index 0927b7bf12cd..c2c0183069b1 100644 --- a/sdk/cosmos/integration-matrix.json +++ b/sdk/cosmos/integration-matrix.json @@ -5,8 +5,9 @@ "ArmTemplateParameters": "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Session' }", "ProfileFlag": "-P integration-test-azure", "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "OSVmImage": "MMSUbuntu2004" - } + "OSVmImage": "MMSUbuntu2004", + "JavaTestVersion": "1.11" + } } } } diff --git a/sdk/cosmos/platform-matrix.json b/sdk/cosmos/platform-matrix.json index fee7a215bcee..5028f72afeff 100644 --- a/sdk/cosmos/platform-matrix.json +++ b/sdk/cosmos/platform-matrix.json @@ -33,7 +33,8 @@ "ProfileFlag": "-Pe2e", "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCIES": "[\"Session\"]", @@ -43,7 +44,8 @@ "ArmTemplateParameters": "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Session' }", "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCIES": [ "[\"Strong\", \"Session\"]", "[\"BoundedStaleness\"]", "[\"ConsistentPrefix\"]" ], @@ -53,7 +55,8 @@ "ProfileFlag": "-Pfast", "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCY": "BoundedStaleness", @@ -63,7 +66,8 @@ "ArmTemplateParameters": "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Strong' }", "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCIES": "[\"Strong\", \"Session\"]", @@ -73,7 +77,8 @@ "ArmTemplateParameters": "@{ enableMultipleWriteLocations = $false; defaultConsistencyLevel = 'Strong' }", "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCIES": "[\"Session\"]", @@ -92,7 +97,8 @@ "ProfileFlag": [ "-Pmulti-master", "-Pfast", "-Pdirect", "-Pnon-emulator" ], "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" }, { "DESIRED_CONSISTENCIES": "[\"Session\"]", @@ -107,7 +113,8 @@ "PREFERRED_LOCATIONS": null, "Agent": { "ubuntu": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" } - } + }, + "JavaTestVersion": "1.11" } ] } diff --git a/sdk/cosmos/spark.databricks.yml b/sdk/cosmos/spark.databricks.yml index 8fa584e742d4..a270f7d5aebe 100644 --- a/sdk/cosmos/spark.databricks.yml +++ b/sdk/cosmos/spark.databricks.yml @@ -31,7 +31,7 @@ stages: goals: 'package' options: '$(DefaultOptions) -T 1 -DsparkShading -Ppackage-assembly -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true -pl com.azure:azure-cosmos,com.azure.cosmos.spark:${{ parameters.SparkVersion }}' javaHomeOption: 'JDKVersion' - jdkVersionOption: $(JavaBuildVersion) + jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - task: UsePythonVersion@0 diff --git a/sdk/cosmos/tests.yml b/sdk/cosmos/tests.yml index 6f6f4e35518d..25653de37e21 100644 --- a/sdk/cosmos/tests.yml +++ b/sdk/cosmos/tests.yml @@ -19,6 +19,8 @@ stages: Path: sdk/cosmos/platform-matrix.json Selection: all GenerateVMJobs: true + MatrixReplace: + - JavaTestVersion=(.*1)\.17(.*)/$1.11$2 ServiceDirectory: cosmos Artifacts: - name: azure-cosmos @@ -48,6 +50,8 @@ stages: Path: sdk/cosmos/integration-matrix.json Selection: all GenerateVMJobs: true + MatrixReplace: + - JavaTestVersion=(.*1)\.17(.*)/$1.11$2 ServiceDirectory: cosmos Artifacts: - name: azure-spring-data-cosmos-test diff --git a/sdk/deviceupdate/azure-iot-deviceupdate/src/samples/README.md b/sdk/deviceupdate/azure-iot-deviceupdate/src/samples/README.md index 41632b2ba5d5..313644acba17 100644 --- a/sdk/deviceupdate/azure-iot-deviceupdate/src/samples/README.md +++ b/sdk/deviceupdate/azure-iot-deviceupdate/src/samples/README.md @@ -24,12 +24,12 @@ You need to use AzureDeviceUpdateClientBuilder to create a proper valid AzureDev let you access the other clients - Updates and Management. In the sample `ListDevicesSample`, it creates `DeviceManagementAsyncClient`. ```java com.azure.iot.deviceupdate.DeviceManagementAsyncClient.instantiate -DeviceManagementAsyncClient client = new DeviceUpdateClientBuilder() +DeviceManagementAsyncClient client = new DeviceManagementClientBuilder() .endpoint(Configuration.getGlobalConfiguration().get("AZURE_ACCOUNT_ENDPOINT")) .instanceId(Configuration.getGlobalConfiguration().get("AZURE_INSTANCE_ID")) .credential(new DefaultAzureCredentialBuilder().build()) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) - .buildDeviceManagementAsyncClient(); + .buildAsyncClient(); ``` ## List Devices diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroException.java b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroException.java index 063fe525e0e9..5897b821885d 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroException.java +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroException.java @@ -9,6 +9,9 @@ * Represents an exception that is thrown when Avro serialization or deserialization fails. */ public class SchemaRegistryApacheAvroException extends AzureException { + /** + * The id of the schema being processed when this exception occurred. {@code null} if there was none. + */ private final String schemaId; /** diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/AadWebSecurityConfigurerAdapter.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/AadWebSecurityConfigurerAdapter.java index 9071d3bf4ec9..6dbd0c90d170 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/AadWebSecurityConfigurerAdapter.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/AadWebSecurityConfigurerAdapter.java @@ -31,9 +31,15 @@ */ public abstract class AadWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { + /** + * A repository for OAuth 2.0 / OpenID Connect 1.0 ClientRegistration(s). + */ @Autowired protected ClientRegistrationRepository repo; + /** + * OIDC user service. + */ @Autowired protected OAuth2UserService oidcUserService; diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadAuthenticationProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadAuthenticationProperties.java index 8fbbbdcdd9b9..48cfbbdd1baf 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadAuthenticationProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadAuthenticationProperties.java @@ -38,6 +38,9 @@ */ public class AadAuthenticationProperties implements InitializingBean { + /** + * Properties prefix. + */ public static final String PREFIX = "spring.cloud.azure.active-directory"; private static final Logger LOGGER = LoggerFactory.getLogger(AadAuthenticationProperties.class); @@ -235,10 +238,20 @@ public void setAllowedGroupNames(List allowedGroupNames) { this.allowedGroupNames = allowedGroupNames; } + /** + * Whether transitive members are used. + * + * @return Whether transitive members are used. + */ public boolean isUseTransitiveMembers() { return useTransitiveMembers; } + /** + * Sets whether transitive members are used. + * + * @param useTransitiveMembers Whether transitive members are used. + */ public void setUseTransitiveMembers(boolean useTransitiveMembers) { this.useTransitiveMembers = useTransitiveMembers; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadResourceServerProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadResourceServerProperties.java index 699392d46c9a..e4344aa35146 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadResourceServerProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/aad/properties/AadResourceServerProperties.java @@ -19,6 +19,9 @@ */ public class AadResourceServerProperties implements InitializingBean { + /** + * Properties prefix. + */ public static final String PREFIX = "spring.cloud.azure.active-directory.resource-server"; /** diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureContextUtils.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureContextUtils.java index 7c444a541664..355be7ff172e 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureContextUtils.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureContextUtils.java @@ -4,7 +4,7 @@ package com.azure.spring.cloud.autoconfigure.context; /** - * + * Azure Context utilities. */ public abstract class AzureContextUtils { @@ -12,39 +12,78 @@ private AzureContextUtils() { } + /** + * Default token credential bean name. + */ public static final String DEFAULT_TOKEN_CREDENTIAL_BEAN_NAME = "springCloudAzureDefaultCredential"; + /** + * Default credential task executory bean name. + */ public static final String DEFAULT_CREDENTIAL_TASK_EXECUTOR_BEAN_NAME = "springCloudAzureCredentialTaskExecutor"; + /** + * Default credential thread name prefix. + */ public static final String DEFAULT_CREDENTIAL_THREAD_NAME_PREFIX = "az-identity-"; + /** + * Event Hubs client builder factory bean name. + */ public static final String EVENT_HUB_CLIENT_BUILDER_FACTORY_BEAN_NAME = "springCloudAzureEventHubsClientBuilderFactory"; + /** + * Event Hubs consumer client builder factory bean name. + */ public static final String EVENT_HUB_CONSUMER_CLIENT_BUILDER_FACTORY_BEAN_NAME = "springCloudAzureEventHubsConsumerClientBuilderFactory"; + /** + * Event Hubs consumer client builder bean name. + */ public static final String EVENT_HUB_CONSUMER_CLIENT_BUILDER_BEAN_NAME = "springCloudAzureEventHubsConsumerClientBuilder"; + /** + * Event Hubs producer client builder factory bean name. + */ public static final String EVENT_HUB_PRODUCER_CLIENT_BUILDER_FACTORY_BEAN_NAME = "springCloudAzureEventHubsProducerClientBuilderFactory"; + /** + * Event Hubs producer client builder bean name. + */ public static final String EVENT_HUB_PRODUCER_CLIENT_BUILDER_BEAN_NAME = "springCloudAzureEventHubsProducerClientBuilder"; + /** + * Azure global properties bean name. + */ public static final String AZURE_GLOBAL_PROPERTY_BEAN_NAME = "springCloudAzureGlobalProperties"; + /** + * Event Hubs processor checkpoint store storage client builder factory bean name. + */ public static final String EVENT_HUB_PROCESSOR_CHECKPOINT_STORE_STORAGE_CLIENT_BUILDER_FACTORY_BEAN_NAME = "springCloudAzureEventHubsProcessorCheckpointStoreStorageClientBuilderFactory"; + /** + * Event Hubs processor checkpoint store storage client builder bean name. + */ public static final String EVENT_HUB_PROCESSOR_CHECKPOINT_STORE_STORAGE_CLIENT_BUILDER_BEAN_NAME = "springCloudAzureEventHubsProcessorCheckpointStoreStorageClientBuilder"; + /** + * Storage blob client builder factory bean name. + */ public static final String STORAGE_BLOB_CLIENT_BUILDER_FACTORY_BEAN_NAME = "springCloudAzureStorageBlobClientBuilderFactory"; + /** + * Storage blob client builder bean name. + */ public static final String STORAGE_BLOB_CLIENT_BUILDER_BEAN_NAME = "springCloudAzureStorageBlobClientBuilder"; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalProperties.java index 41f77af0b51f..5fee380bb628 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/context/AzureGlobalProperties.java @@ -21,11 +21,14 @@ import java.util.List; /** - * + * Azure global properties. */ @ConfigurationProperties(prefix = AzureGlobalProperties.PREFIX) public class AzureGlobalProperties implements AzureProperties, RetryOptionsProvider { + /** + * Global properties prefix. + */ public static final String PREFIX = "spring.cloud.azure"; @NestedConfigurationProperty @@ -76,10 +79,20 @@ public static final class GlobalClientConfigurationProperties extends ClientConf private final GlobalHttpClientConfigurationProperties http = new GlobalHttpClientConfigurationProperties(); private final GlobalAmqpClientConfigurationProperties amqp = new GlobalAmqpClientConfigurationProperties(); + /** + * Gets the global HTTP client configuration properties. + * + * @return The global HTTP client configuration properties. + */ public GlobalHttpClientConfigurationProperties getHttp() { return http; } + /** + * Gets the global AMQP client configuration properties. + * + * @return The global AMQP client configuration properties. + */ public GlobalAmqpClientConfigurationProperties getAmqp() { return amqp; } @@ -93,10 +106,20 @@ public static final class GlobalProxyConfigurationProperties extends ProxyConfig private final GlobalHttpProxyConfigurationProperties http = new GlobalHttpProxyConfigurationProperties(); private final GlobalAmqpProxyConfigurationProperties amqp = new GlobalAmqpProxyConfigurationProperties(); + /** + * Gets the global HTTP proxy configuration properties. + * + * @return The global HTTP proxy configuration properties. + */ public GlobalHttpProxyConfigurationProperties getHttp() { return http; } + /** + * Gets the global AMQP proxy configuration properties. + * + * @return The global AMQP proxy configuration properties. + */ public GlobalAmqpProxyConfigurationProperties getAmqp() { return amqp; } @@ -109,6 +132,11 @@ public static final class GlobalRetryConfigurationProperties extends RetryConfig private final GlobalAmqpRetryConfigurationProperties amqp = new GlobalAmqpRetryConfigurationProperties(); + /** + * Gets the global AMQP retry configuration properties. + * + * @return The global AMQP retry configuration properties. + */ public GlobalAmqpRetryConfigurationProperties getAmqp() { return amqp; } @@ -124,10 +152,20 @@ public static final class GlobalAmqpRetryConfigurationProperties { */ private Duration tryTimeout; + /** + * Gets the try timeout. + * + * @return The try timeout. + */ public Duration getTryTimeout() { return tryTimeout; } + /** + * Sets the try timeout. + * + * @param tryTimeout The try timeout. + */ public void setTryTimeout(Duration tryTimeout) { this.tryTimeout = tryTimeout; } @@ -144,10 +182,20 @@ public static final class GlobalHttpProxyConfigurationProperties { */ private String nonProxyHosts; + /** + * Gets the non-proxy hosts. + * + * @return The non-proxy hosts. + */ public String getNonProxyHosts() { return nonProxyHosts; } + /** + * Sets the non-proxy hosts. + * + * @param nonProxyHosts The non-proxy hosts. + */ public void setNonProxyHosts(String nonProxyHosts) { this.nonProxyHosts = nonProxyHosts; } @@ -163,10 +211,20 @@ public static final class GlobalAmqpProxyConfigurationProperties { */ private String authenticationType; + /** + * Gets the authentication type. + * + * @return The authentication type. + */ public String getAuthenticationType() { return authenticationType; } + /** + * Sets the authentication type. + * + * @param authenticationType The authentication type. + */ public void setAuthenticationType(String authenticationType) { this.authenticationType = authenticationType; } @@ -209,58 +267,128 @@ public static final class GlobalHttpClientConfigurationProperties { @NestedConfigurationProperty private final HttpLoggingConfigurationProperties logging = new HttpLoggingConfigurationProperties(); + /** + * Gets the write timeout. + * + * @return The write timeout. + */ public Duration getWriteTimeout() { return writeTimeout; } + /** + * Sets the write timeout. + * + * @param writeTimeout The write timeout. + */ public void setWriteTimeout(Duration writeTimeout) { this.writeTimeout = writeTimeout; } + /** + * Gets the response timeout. + * + * @return The response timeout. + */ public Duration getResponseTimeout() { return responseTimeout; } + /** + * Sets the response timeout. + * + * @param responseTimeout The response timeout. + */ public void setResponseTimeout(Duration responseTimeout) { this.responseTimeout = responseTimeout; } + /** + * Gets the read timeout. + * + * @return The read timeout. + */ public Duration getReadTimeout() { return readTimeout; } + /** + * Sets the read timeout. + * + * @param readTimeout The read timeout. + */ public void setReadTimeout(Duration readTimeout) { this.readTimeout = readTimeout; } + /** + * Gets the connect timeout. + * + * @return The connect timeout. + */ public Duration getConnectTimeout() { return connectTimeout; } + /** + * Sets the connect timeout. + * + * @param connectTimeout The connect timeout. + */ public void setConnectTimeout(Duration connectTimeout) { this.connectTimeout = connectTimeout; } + /** + * Gets the maximum connection pool size. + * + * @return The maximum connection pool size. + */ public Integer getMaximumConnectionPoolSize() { return maximumConnectionPoolSize; } + /** + * Sets the maximum connection pool size. + * + * @param maximumConnectionPoolSize The maximum connection pool size. + */ public void setMaximumConnectionPoolSize(Integer maximumConnectionPoolSize) { this.maximumConnectionPoolSize = maximumConnectionPoolSize; } + /** + * Gets the connection idle timeout. + * + * @return The connection idle timeout. + */ public Duration getConnectionIdleTimeout() { return connectionIdleTimeout; } + /** + * Sets the connection idle timeout. + * + * @param connectionIdleTimeout The connection idle timeout. + */ public void setConnectionIdleTimeout(Duration connectionIdleTimeout) { this.connectionIdleTimeout = connectionIdleTimeout; } + /** + * Gets the headers. + * + * @return The headers. + */ public List getHeaders() { return headers; } + /** + * Gets the HTTP logging configuration properties. + * + * @return The HTTP logging configuration properties. + */ public HttpLoggingConfigurationProperties getLogging() { return logging; } @@ -276,10 +404,20 @@ public static final class GlobalAmqpClientConfigurationProperties { */ private AmqpTransportType transportType = AmqpTransportType.AMQP; + /** + * Gets the AMQP transport type. + * + * @return The AMQP transport type. + */ public AmqpTransportType getTransportType() { return transportType; } + /** + * Sets the AMQP transport type. + * + * @param transportType The AMQP transport type. + */ public void setTransportType(AmqpTransportType transportType) { this.transportType = transportType; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java index 713968af4f6a..cfa9c66fa27b 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhubs/AzureEventHubsMessagingAutoConfiguration.java @@ -79,7 +79,15 @@ NamespaceProperties eventHubsNamespaceProperties(AzureEventHubsProperties proper @ConditionalOnBean(CheckpointStore.class) public static class ProcessorContainerConfiguration { - + /** + * Creates the default Event Hubs namespace processor factory. + * + * @param properties Event Hubs namespace related properties. + * @param checkpointStore Checkpoint store for storing and retrieving partition ownership information and + * checkpoint details for each partition. + * @param suppliers Object provider suppliers. + * @return A default Event Hubs namespace processor factory. + */ @Bean @ConditionalOnMissingBean public EventHubsProcessorFactory defaultEventHubsNamespaceProcessorFactory( @@ -97,6 +105,13 @@ public EventHubsProcessorFactory defaultEventHubsNamespaceProcessorFactory( @Configuration(proxyBeanMethods = false) public static class EventHubsTemplateConfiguration { + /** + * Creates a default Event Hubs namespace producer factory. + * + * @param properties Event Hubs namespace related properties. + * @param suppliers Object provider suppliers. + * @return A default Event Hubs namespace producer factory. + */ @Bean @ConditionalOnMissingBean public EventHubsProducerFactory defaultEventHubsNamespaceProducerFactory( @@ -105,12 +120,24 @@ public EventHubsProducerFactory defaultEventHubsNamespaceProducerFactory( return new DefaultEventHubsNamespaceProducerFactory(properties, suppliers.getIfAvailable()); } + /** + * Creates an Event Hubs message converter. + * + * @return An Event Hubs message converter. + */ @Bean @ConditionalOnMissingBean public EventHubsMessageConverter eventHubsMessageConverter() { return new EventHubsMessageConverter(); } + /** + * Creates an Event Hubs template. + * + * @param producerFactory An Event Hubs producer factory. + * @param messageConverter An Event Hubs message converter. + * @return An Event Hubs template. + */ @Bean @ConditionalOnMissingBean public EventHubsTemplate eventHubsTemplate(EventHubsProducerFactory producerFactory, diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/jms/properties/AzureServiceBusJmsProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/jms/properties/AzureServiceBusJmsProperties.java index 588e859488d1..78f4d7626350 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/jms/properties/AzureServiceBusJmsProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/jms/properties/AzureServiceBusJmsProperties.java @@ -19,6 +19,9 @@ @ConfigurationProperties(prefix = AzureServiceBusJmsProperties.PREFIX) public class AzureServiceBusJmsProperties implements InitializingBean { + /** + * Service Bus JMS properties prefix. + */ public static final String PREFIX = "spring.jms.servicebus"; private static final String DEFAULT_REMOTE_URL = "amqp://localhost:5672"; @@ -249,42 +252,92 @@ public static class PrefetchPolicy { */ private int topicPrefetch = 0; + /** + * Gets the all prefetch value. + * + * @return The all prefect value. + */ public int getAll() { return Math.max(all, 0); } + /** + * Sets the all prefetch value. + * + * @param all The all prefetch value. + */ public void setAll(int all) { this.all = all; } + /** + * Gets the durable topic prefetch value. + * + * @return The durable topic prefetch value. + */ public int getDurableTopicPrefetch() { return durableTopicPrefetch > 0 ? durableTopicPrefetch : getAll(); } + /** + * Sets the durable topic prefetch value. + * + * @param durableTopicPrefetch The durable topic prefetch value. + */ public void setDurableTopicPrefetch(int durableTopicPrefetch) { this.durableTopicPrefetch = durableTopicPrefetch; } + /** + * Gets the queue browser prefetch value. + * + * @return The queue browser prefetch value. + */ public int getQueueBrowserPrefetch() { return queueBrowserPrefetch > 0 ? queueBrowserPrefetch : getAll(); } + /** + * Sets the queue browser prefetch value. + * + * @param queueBrowserPrefetch The queue browser prefetch value. + */ public void setQueueBrowserPrefetch(int queueBrowserPrefetch) { this.queueBrowserPrefetch = queueBrowserPrefetch; } + /** + * Gets the queue prefetch value. + * + * @return The queue prefetch value. + */ public int getQueuePrefetch() { return queuePrefetch > 0 ? queuePrefetch : getAll(); } + /** + * Sets the queue prefetch value. + * + * @param queuePrefetch The queue prefetch value. + */ public void setQueuePrefetch(int queuePrefetch) { this.queuePrefetch = queuePrefetch; } + /** + * Gets the topic prefetch value. + * + * @return The topic prefetch value. + */ public int getTopicPrefetch() { return topicPrefetch > 0 ? topicPrefetch : getAll(); } + /** + * Sets the topic prefetch value. + * + * @param topicPrefetch The topic prefetch value. + */ public void setTopicPrefetch(int topicPrefetch) { this.topicPrefetch = topicPrefetch; } @@ -321,42 +374,92 @@ public static class Listener { */ private Integer phase; + /** + * Whether reply destination type is topic. + * + * @return Whether reply destination type is topic. + */ public Boolean isReplyPubSubDomain() { return replyPubSubDomain; } + /** + * Sets whether reply destination is topic. + * + * @param replyPubSubDomain Whether reply destination is topic. + */ public void setReplyPubSubDomain(Boolean replyPubSubDomain) { this.replyPubSubDomain = replyPubSubDomain; } + /** + * Gets the reply QoS settings. + * + * @return The reply QoS settings. + */ public QosSettings getReplyQosSettings() { return replyQosSettings; } + /** + * Sets the reply QoS settings. + * + * @param replyQosSettings The reply QoS settings. + */ public void setReplyQosSettings(QosSettings replyQosSettings) { this.replyQosSettings = replyQosSettings; } + /** + * Whether the subscription is durable. + * + * @return Whether the subscription is durable. + */ public Boolean isSubscriptionDurable() { return subscriptionDurable; } + /** + * Sets whether the subscription is durable. + * + * @param subscriptionDurable Whether the subscription is durable. + */ public void setSubscriptionDurable(Boolean subscriptionDurable) { this.subscriptionDurable = subscriptionDurable; } + /** + * Whether the subscription is shared. + * + * @return Whether the subscription is shared. + */ public Boolean isSubscriptionShared() { return subscriptionShared; } + /** + * Sets whether the subscription is shared. + * + * @param subscriptionShared Whether the subscription is shared. + */ public void setSubscriptionShared(Boolean subscriptionShared) { this.subscriptionShared = subscriptionShared; } + /** + * Gets the phase. + * + * @return The phase. + */ public Integer getPhase() { return phase; } + /** + * Sets the phase. + * + * @param phase The phase. + */ public void setPhase(Integer phase) { this.phase = phase; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/environment/KeyVaultEnvironmentPostProcessor.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/environment/KeyVaultEnvironmentPostProcessor.java index 95f7da1fa0a6..a9a25f572d42 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/environment/KeyVaultEnvironmentPostProcessor.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/keyvault/environment/KeyVaultEnvironmentPostProcessor.java @@ -35,6 +35,9 @@ */ public class KeyVaultEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { + /** + * The order value of the {@link KeyVaultEnvironmentPostProcessor}. + */ public static final int ORDER = ConfigDataEnvironmentPostProcessor.ORDER + 1; private static final String SKIP_CONFIGURE_REASON_FORMAT = "Skip configuring Key Vault PropertySource because %s."; diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/properties/core/profile/AzureProfileConfigurationProperties.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/properties/core/profile/AzureProfileConfigurationProperties.java index 351428a245dd..b8a1cbbaf12e 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/properties/core/profile/AzureProfileConfigurationProperties.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/properties/core/profile/AzureProfileConfigurationProperties.java @@ -75,7 +75,7 @@ public AzureEnvironmentConfigurationProperties getEnvironment() { } /** - * + * Azure environment configuration properties. */ public static final class AzureEnvironmentConfigurationProperties implements AzureProfileOptionsProvider.AzureEnvironmentOptions { /** @@ -160,6 +160,11 @@ public String getPortal() { return portal; } + /** + * Sets the portal. + * + * @param portal The portal. + */ public void setPortal(String portal) { this.portal = portal; } @@ -169,6 +174,11 @@ public String getPublishingProfile() { return publishingProfile; } + /** + * Sets the publishing profile. + * + * @param publishingProfile The publishing profile. + */ public void setPublishingProfile(String publishingProfile) { this.publishingProfile = publishingProfile; } @@ -178,6 +188,11 @@ public String getManagementEndpoint() { return managementEndpoint; } + /** + * Sets the management endpoint. + * + * @param managementEndpoint The management endpoint. + */ public void setManagementEndpoint(String managementEndpoint) { this.managementEndpoint = managementEndpoint; } @@ -187,6 +202,11 @@ public String getResourceManagerEndpoint() { return resourceManagerEndpoint; } + /** + * Sets the resource manager endpoint. + * + * @param resourceManagerEndpoint The resource manager endpoint. + */ public void setResourceManagerEndpoint(String resourceManagerEndpoint) { this.resourceManagerEndpoint = resourceManagerEndpoint; } @@ -196,6 +216,11 @@ public String getSqlManagementEndpoint() { return sqlManagementEndpoint; } + /** + * Sets the SQL management endpoint. + * + * @param sqlManagementEndpoint The SQL management endpoint. + */ public void setSqlManagementEndpoint(String sqlManagementEndpoint) { this.sqlManagementEndpoint = sqlManagementEndpoint; } @@ -205,6 +230,11 @@ public String getSqlServerHostnameSuffix() { return sqlServerHostnameSuffix; } + /** + * Sets the SQL server hostname suffix. + * + * @param sqlServerHostnameSuffix The SQL server hostname suffix. + */ public void setSqlServerHostnameSuffix(String sqlServerHostnameSuffix) { this.sqlServerHostnameSuffix = sqlServerHostnameSuffix; } @@ -214,6 +244,11 @@ public String getGalleryEndpoint() { return galleryEndpoint; } + /** + * Sets the gallery endpoint. + * + * @param galleryEndpoint The gallery endpoint. + */ public void setGalleryEndpoint(String galleryEndpoint) { this.galleryEndpoint = galleryEndpoint; } @@ -223,6 +258,11 @@ public String getActiveDirectoryEndpoint() { return activeDirectoryEndpoint; } + /** + * Sets the active directory endpoint. + * + * @param activeDirectoryEndpoint The active directory endpoint. + */ public void setActiveDirectoryEndpoint(String activeDirectoryEndpoint) { this.activeDirectoryEndpoint = activeDirectoryEndpoint; } @@ -232,6 +272,11 @@ public String getActiveDirectoryResourceId() { return activeDirectoryResourceId; } + /** + * Sets the active directory resource ID. + * + * @param activeDirectoryResourceId The active directory resource ID. + */ public void setActiveDirectoryResourceId(String activeDirectoryResourceId) { this.activeDirectoryResourceId = activeDirectoryResourceId; } @@ -241,6 +286,11 @@ public String getActiveDirectoryGraphEndpoint() { return activeDirectoryGraphEndpoint; } + /** + * Sets the active directory graph endpoint. + * + * @param activeDirectoryGraphEndpoint The active directory graph endpoint. + */ public void setActiveDirectoryGraphEndpoint(String activeDirectoryGraphEndpoint) { this.activeDirectoryGraphEndpoint = activeDirectoryGraphEndpoint; } @@ -250,6 +300,11 @@ public String getActiveDirectoryGraphApiVersion() { return activeDirectoryGraphApiVersion; } + /** + * Sets the active directory graph API version. + * + * @param activeDirectoryGraphApiVersion The active directory graph API version. + */ public void setActiveDirectoryGraphApiVersion(String activeDirectoryGraphApiVersion) { this.activeDirectoryGraphApiVersion = activeDirectoryGraphApiVersion; } @@ -259,6 +314,11 @@ public String getMicrosoftGraphEndpoint() { return microsoftGraphEndpoint; } + /** + * Sets the Microsoft Graph endpoint. + * + * @param microsoftGraphEndpoint The Microsoft Graph endpoint. + */ public void setMicrosoftGraphEndpoint(String microsoftGraphEndpoint) { this.microsoftGraphEndpoint = microsoftGraphEndpoint; } @@ -268,6 +328,11 @@ public String getDataLakeEndpointResourceId() { return dataLakeEndpointResourceId; } + /** + * Sets the Data Lake endpoint resource ID. + * + * @param dataLakeEndpointResourceId The Data Lake endpoint resource ID. + */ public void setDataLakeEndpointResourceId(String dataLakeEndpointResourceId) { this.dataLakeEndpointResourceId = dataLakeEndpointResourceId; } @@ -277,6 +342,11 @@ public String getStorageEndpointSuffix() { return storageEndpointSuffix; } + /** + * Sets the Storage endpoint suffix. + * + * @param storageEndpointSuffix The Storage endpoint suffix. + */ public void setStorageEndpointSuffix(String storageEndpointSuffix) { this.storageEndpointSuffix = storageEndpointSuffix; } @@ -286,6 +356,11 @@ public String getKeyVaultDnsSuffix() { return keyVaultDnsSuffix; } + /** + * Sets the KeyVault DNS suffix. + * + * @param keyVaultDnsSuffix The KeyVault DNS suffix. + */ public void setKeyVaultDnsSuffix(String keyVaultDnsSuffix) { this.keyVaultDnsSuffix = keyVaultDnsSuffix; } @@ -295,6 +370,11 @@ public String getAzureDataLakeStoreFileSystemEndpointSuffix() { return azureDataLakeStoreFileSystemEndpointSuffix; } + /** + * Sets the Azure Data Lake Storage file system endpoint suffix. + * + * @param azureDataLakeStoreFileSystemEndpointSuffix The Azure Data Lake Storage file system endpoint suffix. + */ public void setAzureDataLakeStoreFileSystemEndpointSuffix(String azureDataLakeStoreFileSystemEndpointSuffix) { this.azureDataLakeStoreFileSystemEndpointSuffix = azureDataLakeStoreFileSystemEndpointSuffix; } @@ -304,6 +384,12 @@ public String getAzureDataLakeAnalyticsCatalogAndJobEndpointSuffix() { return azureDataLakeAnalyticsCatalogAndJobEndpointSuffix; } + /** + * Sets the Azure Data Lake analytics catalog and job endpoint suffix. + * + * @param azureDataLakeAnalyticsCatalogAndJobEndpointSuffix The Azure Data Lake analytics catalog and job + * endpoint suffix. + */ public void setAzureDataLakeAnalyticsCatalogAndJobEndpointSuffix(String azureDataLakeAnalyticsCatalogAndJobEndpointSuffix) { this.azureDataLakeAnalyticsCatalogAndJobEndpointSuffix = azureDataLakeAnalyticsCatalogAndJobEndpointSuffix; } @@ -313,6 +399,11 @@ public String getAzureLogAnalyticsEndpoint() { return azureLogAnalyticsEndpoint; } + /** + * Sets the Azure log analytics endpoint. + * + * @param azureLogAnalyticsEndpoint The Azure log analytics endpoint. + */ public void setAzureLogAnalyticsEndpoint(String azureLogAnalyticsEndpoint) { this.azureLogAnalyticsEndpoint = azureLogAnalyticsEndpoint; } @@ -322,6 +413,11 @@ public String getAzureApplicationInsightsEndpoint() { return azureApplicationInsightsEndpoint; } + /** + * Sets the Azure Application Insights endpoint. + * + * @param azureApplicationInsightsEndpoint The Azure Application Insights endpoint. + */ public void setAzureApplicationInsightsEndpoint(String azureApplicationInsightsEndpoint) { this.azureApplicationInsightsEndpoint = azureApplicationInsightsEndpoint; } diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureServiceResourceManagerConfigurationBase.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureServiceResourceManagerConfigurationBase.java index cbe4bdbdb3fb..7042d848165e 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureServiceResourceManagerConfigurationBase.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/resourcemanager/AzureServiceResourceManagerConfigurationBase.java @@ -12,6 +12,9 @@ @Configuration(proxyBeanMethods = false) public abstract class AzureServiceResourceManagerConfigurationBase { + /** + * The entry point for accessing resource management APIs in Azure. + */ protected AzureResourceManager azureResourceManager; /** diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusMessagingAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusMessagingAutoConfiguration.java index 62d0a7abb84e..267f4f60becb 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusMessagingAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusMessagingAutoConfiguration.java @@ -77,6 +77,13 @@ NamespaceProperties serviceBusNamespaceProperties(AzureServiceBusProperties prop @Configuration(proxyBeanMethods = false) public static class ProcessorContainerConfiguration { + /** + * Creates a default Service Bus namespace processor factory. + * + * @param properties Service Bus namespace properties. + * @param suppliers ObjectProvider suppliers. + * @return A default Service Bus namespace processor factory. + */ @Bean @ConditionalOnMissingBean public ServiceBusProcessorFactory defaultServiceBusNamespaceProcessorFactory( @@ -92,6 +99,13 @@ public ServiceBusProcessorFactory defaultServiceBusNamespaceProcessorFactory( @Configuration(proxyBeanMethods = false) public static class ServiceBusTemplateConfiguration { + /** + * Creates a default Service Bus namespace producer factory. + * + * @param properties Service Bus namespace properties. + * @param suppliers ObjectProvider suppliers. + * @return A default Service Bus namespace producer factory. + */ @Bean @ConditionalOnMissingBean public ServiceBusProducerFactory defaultServiceBusNamespaceProducerFactory( @@ -100,12 +114,24 @@ public ServiceBusProducerFactory defaultServiceBusNamespaceProducerFactory( return new DefaultServiceBusNamespaceProducerFactory(properties, suppliers.getIfAvailable()); } + /** + * Creates a Service Bus message converter. + * + * @return A Service Bus message converter. + */ @Bean @ConditionalOnMissingBean public ServiceBusMessageConverter serviceBusMessageConverter() { return new ServiceBusMessageConverter(); } + /** + * Creates a Service Bus template. + * + * @param senderClientfactory A Service Bus producer factory. + * @param messageConverter A Service Bus message converter. + * @return A Service Bus template. + */ @Bean @ConditionalOnMissingBean @ConditionalOnBean(ServiceBusProducerFactory.class) diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/trace/sleuth/AzureSleuthAutoConfiguration.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/trace/sleuth/AzureSleuthAutoConfiguration.java index 498c5605e4a4..b584c3305914 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/trace/sleuth/AzureSleuthAutoConfiguration.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/trace/sleuth/AzureSleuthAutoConfiguration.java @@ -27,6 +27,9 @@ @ConditionalOnProperty(value = "spring.sleuth.enabled", matchIfMissing = true) public class AzureSleuthAutoConfiguration { + /** + * Default sleuth HTTP policy bean name. + */ public static final String DEFAULT_SLEUTH_HTTP_POLICY_BEAN_NAME = "AzureSleuthHttpPolicy"; /** diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/AppConfigurationUserAgentTests.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/AppConfigurationUserAgentTests.java index 9adab09defef..290829b02d3e 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/AppConfigurationUserAgentTests.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/AppConfigurationUserAgentTests.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.parallel.Isolated; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; @@ -28,6 +29,7 @@ * The reason why the User-Agent not outputted in log is not clear. */ @Disabled +@Isolated("Run this by itself as it captures System.out") @ExtendWith(OutputCaptureExtension.class) public class AppConfigurationUserAgentTests { diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultCertificateUserAgentTests.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultCertificateUserAgentTests.java index 6b172ad6fb8d..f17c7bef2b30 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultCertificateUserAgentTests.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultCertificateUserAgentTests.java @@ -13,6 +13,7 @@ import com.azure.spring.cloud.service.implementation.keyvault.certificates.CertificateClientBuilderFactory; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.parallel.Isolated; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; @@ -20,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; +@Isolated("Run this by itself as it captures System.out") @ExtendWith(OutputCaptureExtension.class) public class KeyVaultCertificateUserAgentTests { diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultSecretUserAgentTests.java b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultSecretUserAgentTests.java index f09187ce6279..c934bf387160 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultSecretUserAgentTests.java +++ b/sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/useragent/http/KeyVaultSecretUserAgentTests.java @@ -13,6 +13,7 @@ import com.azure.spring.cloud.service.implementation.keyvault.secrets.SecretClientBuilderFactory; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.parallel.Isolated; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; @@ -20,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat; +@Isolated("Run this by itself as it captures System.out") @ExtendWith(OutputCaptureExtension.class) public class KeyVaultSecretUserAgentTests { diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java index 3606fe9dd05f..a343716ec935 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java @@ -53,11 +53,29 @@ interface ProfileOptions { * types will be OTHER. */ enum CloudType { - + /** + * Azure + */ AZURE, + + /** + * Azure China + */ AZURE_CHINA, + + /** + * Azure Germany + */ AZURE_GERMANY, + + /** + * Azure US government + */ AZURE_US_GOVERNMENT, + + /** + * Other + */ OTHER } diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/RetryOptionsProvider.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/RetryOptionsProvider.java index 7ae043cf4360..8c723fab9dfd 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/RetryOptionsProvider.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/RetryOptionsProvider.java @@ -107,7 +107,14 @@ interface AmqpRetryOptions extends RetryOptions { */ enum RetryMode { + /** + * Fixed backoff retry mode. + */ FIXED, + + /** + * Exponential backoff retry mode. + */ EXPONENTIAL } } diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/resource/AbstractAzureStorageProtocolResolver.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/resource/AbstractAzureStorageProtocolResolver.java index d3bcb4ba847b..4708f8ace208 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/resource/AbstractAzureStorageProtocolResolver.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/resource/AbstractAzureStorageProtocolResolver.java @@ -47,6 +47,9 @@ public abstract class AbstractAzureStorageProtocolResolver implements ProtocolRe */ protected abstract Resource getStorageResource(String location, Boolean autoCreate); + /** + * The bean factory used by the application context. + */ protected ConfigurableListableBeanFactory beanFactory; /** @@ -54,7 +57,7 @@ public abstract class AbstractAzureStorageProtocolResolver implements ProtocolRe *

* The underlying storage system may support 'prefix' filter, for example, Azure Storage Blob supports this *

- * https://docs.microsoft.com/rest/api/storageservices/list-blobs + * https://docs.microsoft.com/rest/api/storageservices/list-blobs *

* In this case, we can avoid load all containers to do client side filtering. * @@ -146,56 +149,106 @@ public ClassLoader getClassLoader() { return ClassUtils.getDefaultClassLoader(); } - + /** + * Storage container item. + */ protected static class StorageContainerItem { private final String name; + /** + * Creates a new instance of {@link StorageContainerItem}. + * + * @param name Name of the container item. + */ public StorageContainerItem(String name) { this.name = name; } + /** + * Gets the name of the container item. + * + * @return The name of the container item. + */ public String getName() { return name; } } + /** + * Storage item. + */ protected static class StorageItem { private final String container; private final String name; private final StorageType storageType; + /** + * Creates a new instance of {@link StorageItem}. + * + * @param container The container name. + * @param fileName The file name. + * @param storageType The storage type. + */ public StorageItem(String container, String fileName, StorageType storageType) { this.container = container; this.name = fileName; this.storageType = storageType; } + /** + * Gets the container name. + * + * @return The container name. + */ public String getContainer() { return container; } + /** + * Gets the item name. + * + * @return The item name. + */ public String getName() { return name; } + /** + * Gets the storage type. + * + * @return The storage type. + */ public StorageType getStorageType() { return storageType; } + /** + * Gets the resource location equivalent for this item. + * + * @return The resource location equivalent for this item. + */ public String toResourceLocation() { return AzureStorageUtils.getStorageProtocolPrefix(getStorageType()) + container + "/" + name; } } + /** + * Storage container client. + */ protected interface StorageContainerClient { + /** + * Gets the container name. + * + * @return The container name. + */ String getName(); /** - *

* Normally, a cloud storage system doesn't support wildcard pattern matching, but support prefix match + * * @param itemPrefix the prefix of item’s path * @return All items with the given prefix, or all items if the underlying system doesn't * support prefix matching. diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/service/AzureServiceType.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/service/AzureServiceType.java index 92887b72ea8f..e0fafce0e15e 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/service/AzureServiceType.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/service/AzureServiceType.java @@ -11,11 +11,34 @@ */ public final class AzureServiceType { + /** + * The Service Bus service. + */ public static final ServiceBus SERVICE_BUS = new ServiceBus(); + + /** + * The Event Hub service. + */ public static final EventHubs EVENT_HUBS = new EventHubs(); + + /** + * The Storage Blob service. + */ public static final StorageBlob STORAGE_BLOB = new StorageBlob(); + + /** + * The Storage File Share service. + */ public static final StorageFileShare STORAGE_FILE_SHARE = new StorageFileShare(); + + /** + * The Storage Queue service. + */ public static final StorageQueue STORAGE_QUEUE = new StorageQueue(); + + /** + * The App Configuration service. + */ public static final AppConfiguration APP_CONFIGURATION = new AppConfiguration(); private AzureServiceType() { diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/servicebus/properties/ServiceBusEntityType.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/servicebus/properties/ServiceBusEntityType.java index 2b0e3af70ef0..deb22dd1b42e 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/servicebus/properties/ServiceBusEntityType.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/servicebus/properties/ServiceBusEntityType.java @@ -6,6 +6,13 @@ * Entity type of Service Bus. */ public enum ServiceBusEntityType { + /** + * Queue + */ QUEUE, + + /** + * Topic + */ TOPIC } diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/core/properties/EventHubsExtendedBindingProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/core/properties/EventHubsExtendedBindingProperties.java index acc292b3b36d..2ce659eb23cb 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/core/properties/EventHubsExtendedBindingProperties.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/src/main/java/com/azure/spring/cloud/stream/binder/eventhubs/core/properties/EventHubsExtendedBindingProperties.java @@ -15,7 +15,7 @@ import java.util.Objects; /** - * + * Event Hubs extended binding properties. */ @ConfigurationProperties(EventHubsExtendedBindingProperties.PREFIX) public class EventHubsExtendedBindingProperties @@ -23,6 +23,9 @@ public class EventHubsExtendedBindingProperties EventHubsBindingProperties> implements InitializingBean { + /** + * Event Hubs extended binding properties prefix. + */ public static final String PREFIX = "spring.cloud.stream.eventhubs"; private static final String DEFAULTS_PREFIX = PREFIX + ".default"; private static final Logger LOGGER = LoggerFactory.getLogger(EventHubsExtendedBindingProperties.class); diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml index 3528f3f85204..a63071647063 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml @@ -81,18 +81,6 @@ 2.6.7 test - - org.powermock - powermock-module-junit4 - 2.0.9 - test - - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/src/main/java/com/azure/spring/cloud/stream/binder/servicebus/core/properties/ServiceBusConsumerProperties.java b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/src/main/java/com/azure/spring/cloud/stream/binder/servicebus/core/properties/ServiceBusConsumerProperties.java index ff0945f27bf4..33efcbde0ada 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/src/main/java/com/azure/spring/cloud/stream/binder/servicebus/core/properties/ServiceBusConsumerProperties.java +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/src/main/java/com/azure/spring/cloud/stream/binder/servicebus/core/properties/ServiceBusConsumerProperties.java @@ -6,7 +6,7 @@ import com.azure.spring.messaging.servicebus.core.properties.ProcessorProperties; /** - * + * Service Bus consumer properties. */ public class ServiceBusConsumerProperties extends ProcessorProperties { @@ -15,7 +15,6 @@ public class ServiceBusConsumerProperties extends ProcessorProperties { /** * Controls if the failed messages are routed to the DLQ * - *

* @return boolean, default : false */ public boolean isRequeueRejected() { diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml index 343afa41d358..e89e4bcea1d9 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus/pom.xml @@ -83,18 +83,6 @@ 2.6.7 test - - org.powermock - powermock-module-junit4 - 2.0.9 - test - - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - diff --git a/sdk/spring/spring-cloud-azure-test-eventhubs-binder/pom.xml b/sdk/spring/spring-cloud-azure-test-eventhubs-binder/pom.xml index e801f5d8180d..57e02eced127 100644 --- a/sdk/spring/spring-cloud-azure-test-eventhubs-binder/pom.xml +++ b/sdk/spring/spring-cloud-azure-test-eventhubs-binder/pom.xml @@ -59,15 +59,9 @@ test - org.powermock - powermock-module-junit4 - 2.0.9 - test - - - org.powermock - powermock-api-mockito2 - 2.0.9 + org.junit.vintage + junit-vintage-engine + 5.8.2 test diff --git a/sdk/spring/spring-integration-azure-core/pom.xml b/sdk/spring/spring-integration-azure-core/pom.xml index aa73ce05e50e..bd3eef45169a 100644 --- a/sdk/spring/spring-integration-azure-core/pom.xml +++ b/sdk/spring/spring-integration-azure-core/pom.xml @@ -66,18 +66,6 @@ 5.3.19 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-integration-azure-core/src/main/java/com/azure/spring/integration/core/instrumentation/Instrumentation.java b/sdk/spring/spring-integration-azure-core/src/main/java/com/azure/spring/integration/core/instrumentation/Instrumentation.java index 3ccd2573976c..d71275cc75a7 100644 --- a/sdk/spring/spring-integration-azure-core/src/main/java/com/azure/spring/integration/core/instrumentation/Instrumentation.java +++ b/sdk/spring/spring-integration-azure-core/src/main/java/com/azure/spring/integration/core/instrumentation/Instrumentation.java @@ -12,11 +12,15 @@ public interface Instrumentation { * Specifies the type of queue and topic currently in use. */ enum Type { - + /** + * Consumer + */ CONSUMER, + /** + * Producer + */ PRODUCER - } /** @@ -79,7 +83,14 @@ static String buildId(Type type, String name) { * The status of the instrumented component. */ enum Status { + /** + * Up + */ UP, + + /** + * Down + */ DOWN } } diff --git a/sdk/spring/spring-integration-azure-eventhubs/pom.xml b/sdk/spring/spring-integration-azure-eventhubs/pom.xml index 25a2848a0ddc..b3faa0ba4939 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/pom.xml +++ b/sdk/spring/spring-integration-azure-eventhubs/pom.xml @@ -85,18 +85,6 @@ 3.21.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-integration-azure-servicebus/pom.xml b/sdk/spring/spring-integration-azure-servicebus/pom.xml index c65db74fc2e8..f7f83b979b11 100644 --- a/sdk/spring/spring-integration-azure-servicebus/pom.xml +++ b/sdk/spring/spring-integration-azure-servicebus/pom.xml @@ -79,18 +79,6 @@ 4.0.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-integration-azure-storage-queue/pom.xml b/sdk/spring/spring-integration-azure-storage-queue/pom.xml index 4551bad6917c..6a0cd25ddad4 100644 --- a/sdk/spring/spring-integration-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-integration-azure-storage-queue/pom.xml @@ -62,18 +62,6 @@ 4.0.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-messaging-azure-eventhubs/pom.xml b/sdk/spring/spring-messaging-azure-eventhubs/pom.xml index 841f887c937d..35090cce6149 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/pom.xml +++ b/sdk/spring/spring-messaging-azure-eventhubs/pom.xml @@ -109,24 +109,18 @@ 4.0.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter-api 5.8.2 test + + org.junit.vintage + junit-vintage-engine + 5.8.2 + test + io.projectreactor reactor-test diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplate.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplate.java index 593264b47546..a76b1bece943 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplate.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplate.java @@ -150,7 +150,7 @@ private CreateBatchOptions buildCreateBatchOptions(PartitionSupplier partitionSu .setPartitionKey(partitionSupplier != null ? partitionSupplier.getPartitionKey() : null); } - private PartitionSupplier buildPartitionSupplier(Message message) { + PartitionSupplier buildPartitionSupplier(Message message) { PartitionSupplier partitionSupplier = new PartitionSupplier(); Optional.ofNullable(message.getHeaders().get(PARTITION_KEY)).ifPresent(s -> partitionSupplier.setPartitionKey(String.valueOf(s))); Optional.ofNullable(message.getHeaders().get(PARTITION_ID)).ifPresent(s -> partitionSupplier.setPartitionId(String.valueOf(s))); diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/support/EventHubsHeaders.java b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/support/EventHubsHeaders.java index 55c2088d5716..d54961323d8f 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/support/EventHubsHeaders.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/main/java/com/azure/spring/messaging/eventhubs/support/EventHubsHeaders.java @@ -13,16 +13,53 @@ private EventHubsHeaders() { } + /** + * Header prefix. + */ private static final String PREFIX = AzureHeaders.PREFIX + "eventhubs_"; + /** + * Enqueued time. + */ public static final String ENQUEUED_TIME = PREFIX + "enqueued_time"; + + /** + * Batch converted enqueued time. + */ public static final String BATCH_CONVERTED_ENQUEUED_TIME = PREFIX + "batch_converted_enqueued_time"; + + /** + * Offset. + */ public static final String OFFSET = PREFIX + "offset"; + + /** + * Batch converted offset. + */ public static final String BATCH_CONVERTED_OFFSET = PREFIX + "batch_converted_offset"; + + /** + * Sequence number. + */ public static final String SEQUENCE_NUMBER = PREFIX + "sequence_number"; + + /** + * Batch converted sequence number. + */ public static final String BATCH_CONVERTED_SEQUENCE_NUMBER = PREFIX + "batch_converted_sequence_number"; + + /** + * Last enqueued event properties. + */ public static final String LAST_ENQUEUED_EVENT_PROPERTIES = PREFIX + "last_enqueued_event_properties"; + /** + * Batch converted system properties. + */ public static final String BATCH_CONVERTED_SYSTEM_PROPERTIES = PREFIX + "batch_converted_system_properties"; + + /** + * Batch converted application properties. + */ public static final String BATCH_CONVERTED_APPLICATION_PROPERTIES = PREFIX + "batch_converted_application_properties"; } diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/DefaultEventHubsNamespaceProcessorFactoryTests.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/DefaultEventHubsNamespaceProcessorFactoryTests.java index dccb3ca98b5b..2a695f22234b 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/DefaultEventHubsNamespaceProcessorFactoryTests.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/DefaultEventHubsNamespaceProcessorFactoryTests.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.powermock.api.mockito.PowerMockito.mock; +import static org.mockito.Mockito.mock; class DefaultEventHubsNamespaceProcessorFactoryTests { diff --git a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateSendTests.java b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateSendTests.java index 54f7fa5ba01d..57a6758b6f16 100644 --- a/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateSendTests.java +++ b/sdk/spring/spring-messaging-azure-eventhubs/src/test/java/com/azure/spring/messaging/eventhubs/core/EventHubsTemplateSendTests.java @@ -8,11 +8,13 @@ import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; import com.azure.messaging.eventhubs.models.CreateBatchOptions; import com.azure.spring.messaging.core.SendOperationTests; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; -import org.springframework.test.util.ReflectionTestUtils; import reactor.core.publisher.Mono; import static com.azure.spring.messaging.AzureHeaders.PARTITION_ID; @@ -29,11 +31,18 @@ public class EventHubsTemplateSendTests extends SendOperationTests { + @Mock private EventHubsProducerFactory producerFactory; + + @Mock private EventHubProducerAsyncClient mockProducerClient; - private static final String BUILD_PARTITION_SUPPLIER_METHOD_NAME = "buildPartitionSupplier"; + + private AutoCloseable mockCloseable; + @BeforeEach public void setUp() { + mockCloseable = MockitoAnnotations.openMocks(this); + this.mockProducerClient = mock(EventHubProducerAsyncClient.class); this.producerFactory = mock(EventHubsProducerFactory.class); EventDataBatch eventDataBatch = mock(EventDataBatch.class); @@ -47,6 +56,13 @@ public void setUp() { this.sendOperation = new EventHubsTemplate(producerFactory); } + @AfterEach + public void tearDown() throws Exception { + if (mockCloseable != null) { + mockCloseable.close(); + } + } + @Override public void verifySendCalled(int times) { verify(this.mockProducerClient, times(times)).send(any(EventDataBatch.class)); @@ -68,10 +84,7 @@ public void testGetPartitionIdFromMessageHeader() { Message message = MessageBuilder.withPayload("test") .setHeader(PARTITION_ID, "partition-id") .build(); - PartitionSupplier partitionSupplier = ReflectionTestUtils.invokeMethod(this.sendOperation, - EventHubsTemplate.class, - BUILD_PARTITION_SUPPLIER_METHOD_NAME, - message); + PartitionSupplier partitionSupplier = sendOperation.buildPartitionSupplier(message); assertEquals(partitionSupplier.getPartitionId(), "partition-id"); assertNull(partitionSupplier.getPartitionKey()); } @@ -81,10 +94,7 @@ public void testGetPartitionKeyFromMessageHeader() { Message message = MessageBuilder.withPayload("test") .setHeader(PARTITION_KEY, "partition-key") .build(); - PartitionSupplier partitionSupplier = ReflectionTestUtils.invokeMethod(this.sendOperation, - EventHubsTemplate.class, - BUILD_PARTITION_SUPPLIER_METHOD_NAME, - message); + PartitionSupplier partitionSupplier = sendOperation.buildPartitionSupplier(message); assertNull(partitionSupplier.getPartitionId()); assertEquals(partitionSupplier.getPartitionKey(), "partition-key"); } @@ -95,10 +105,7 @@ public void testGetPartitionIdAndKeyFromMessageHeader() { .setHeader(PARTITION_ID, "partition-id") .setHeader(PARTITION_KEY, "partition-key") .build(); - PartitionSupplier partitionSupplier = ReflectionTestUtils.invokeMethod(this.sendOperation, - EventHubsTemplate.class, - BUILD_PARTITION_SUPPLIER_METHOD_NAME, - message); + PartitionSupplier partitionSupplier = sendOperation.buildPartitionSupplier(message); assertEquals(partitionSupplier.getPartitionId(), "partition-id"); assertEquals(partitionSupplier.getPartitionKey(), "partition-key"); } @@ -106,10 +113,7 @@ public void testGetPartitionIdAndKeyFromMessageHeader() { @Test public void testFailToGetPartitionIFromMessageHeader() { Message message = MessageBuilder.withPayload("test").build(); - PartitionSupplier partitionSupplier = ReflectionTestUtils.invokeMethod(this.sendOperation, - EventHubsTemplate.class, - BUILD_PARTITION_SUPPLIER_METHOD_NAME, - message); + PartitionSupplier partitionSupplier = sendOperation.buildPartitionSupplier(message); assertNull(partitionSupplier.getPartitionId()); assertNull(partitionSupplier.getPartitionKey()); } diff --git a/sdk/spring/spring-messaging-azure-servicebus/pom.xml b/sdk/spring/spring-messaging-azure-servicebus/pom.xml index 3fc1a6a100e1..8fd7b42e91c1 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/pom.xml +++ b/sdk/spring/spring-messaging-azure-servicebus/pom.xml @@ -88,18 +88,6 @@ 4.0.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-messaging-azure-servicebus/src/main/java/com/azure/spring/messaging/servicebus/support/ServiceBusMessageHeaders.java b/sdk/spring/spring-messaging-azure-servicebus/src/main/java/com/azure/spring/messaging/servicebus/support/ServiceBusMessageHeaders.java index c9760d825f0d..5176c46de259 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/src/main/java/com/azure/spring/messaging/servicebus/support/ServiceBusMessageHeaders.java +++ b/sdk/spring/spring-messaging-azure-servicebus/src/main/java/com/azure/spring/messaging/servicebus/support/ServiceBusMessageHeaders.java @@ -46,27 +46,109 @@ private ServiceBusMessageHeaders() { private static final String PREFIX = AzureHeaders.PREFIX + "service_bus_"; + /** + * Correlation ID. + */ public static final String CORRELATION_ID = PREFIX + "correlation_id"; + + /** + * Message ID. + */ public static final String MESSAGE_ID = PREFIX + "message_id"; + + /** + * Partition key. + */ public static final String PARTITION_KEY = PREFIX + "partition_key"; + + /** + * To. + */ public static final String TO = PREFIX + "to"; + + /** + * Time to live. + */ public static final String TIME_TO_LIVE = PREFIX + "time_to_live"; + // expected type is Instant + /** + * Scheduled enqueue time. + */ public static final String SCHEDULED_ENQUEUE_TIME = PREFIX + "scheduled_enqueue_time"; + + /** + * Reply to session ID. + */ public static final String REPLY_TO_SESSION_ID = PREFIX + "reply_to_session_id"; + + /** + * Session ID. + */ public static final String SESSION_ID = PREFIX + "session_id"; + + /** + * Received message context. + */ public static final String RECEIVED_MESSAGE_CONTEXT = PREFIX + "received_message_context"; + /** + * Dead letter error description. + */ public static final String DEAD_LETTER_ERROR_DESCRIPTION = PREFIX + "dead_letter_error_description"; + + /** + * Dead letter reason. + */ public static final String DEAD_LETTER_REASON = PREFIX + "dead_letter_reason"; + + /** + * Dead letter source. + */ public static final String DEAD_LETTER_SOURCE = PREFIX + "dead_letter_source"; + + /** + * Delivery count. + */ public static final String DELIVERY_COUNT = PREFIX + "delivery_count"; + + /** + * Enqueued sequence number. + */ public static final String ENQUEUED_SEQUENCE_NUMBER = PREFIX + "enqueued_sequence_number"; + + /** + * Enqueued time. + */ public static final String ENQUEUED_TIME = PREFIX + "enqueued_time"; + + /** + * Expires at. + */ public static final String EXPIRES_AT = PREFIX + "expires_at"; + + /** + * Lock token. + */ public static final String LOCK_TOKEN = PREFIX + "lock_token"; + + /** + * Locked until. + */ public static final String LOCKED_UNTIL = PREFIX + "locked_until"; + + /** + * Sequence number. + */ public static final String SEQUENCE_NUMBER = PREFIX + "sequence_number"; + + /** + * State. + */ public static final String STATE = PREFIX + "state"; + + /** + * Subject. + */ public static final String SUBJECT = PREFIX + "subject"; } diff --git a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml index d3f84ae7b2b3..ed2f76acb11f 100644 --- a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml @@ -58,18 +58,6 @@ 4.0.0 test - - org.powermock - powermock-api-mockito2 - 2.0.9 - test - - - org.powermock - powermock-module-junit4 - 2.0.9 - test - org.junit.jupiter junit-jupiter diff --git a/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/AzureHeaders.java b/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/AzureHeaders.java index 3baf95abeb84..1073a33121e9 100644 --- a/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/AzureHeaders.java +++ b/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/AzureHeaders.java @@ -15,22 +15,48 @@ protected AzureHeaders() { } + /** + * Header prefix. + */ protected static final String PREFIX = "azure_"; + /** + * Partition ID. + */ public static final String PARTITION_ID = PREFIX + "partition_id"; + + /** + * Raw partition ID. + */ public static final String RAW_PARTITION_ID = PREFIX + "raw_partition_id"; + /** + * Partition key. + */ public static final String PARTITION_KEY = PREFIX + "partition_key"; + + /** + * Batch converted partition key. + */ public static final String BATCH_CONVERTED_PARTITION_KEY = PREFIX + "batch_converted_partition_key"; + /** + * Name. + */ public static final String NAME = PREFIX + "name"; + /** + * Scheduled enqueue message. + */ public static final String SCHEDULED_ENQUEUE_MESSAGE = "x-delay"; /** - * The {@value CHECKPOINTER} header for checkpoint the specific message. + * The CHECKPOINTER header for checkpoint the specific message. */ public static final String CHECKPOINTER = PREFIX + "checkpointer"; + /** + * Message session. + */ public static final String MESSAGE_SESSION = PREFIX + "message_session"; } diff --git a/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/listener/AbstractMessageListenerContainer.java b/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/listener/AbstractMessageListenerContainer.java index 3263fcd3758d..0d6ec7558b4e 100644 --- a/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/listener/AbstractMessageListenerContainer.java +++ b/sdk/spring/spring-messaging-azure/src/main/java/com/azure/spring/messaging/listener/AbstractMessageListenerContainer.java @@ -13,6 +13,9 @@ public abstract class AbstractMessageListenerContainer implements MessageListenerContainer, BeanNameAware { private static final Logger LOG = LoggerFactory.getLogger(AbstractMessageListenerContainer.class); + /** + * Life cycle monitor. + */ protected final Object lifecycleMonitor = new Object(); // Settings that are changed at runtime diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml index f8f19bdb0e20..20c837dc632a 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/pom.xml +++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml @@ -39,9 +39,6 @@ --add-opens com.azure.ai.textanalytics/com.azure.ai.textanalytics=ALL-UNNAMED --add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED - false - -