Skip to content

Commit 3957be7

Browse files
authored
Register provider via policy Part Four (#43425)
1 parent ccbd991 commit 3957be7

File tree

8 files changed

+50
-33
lines changed

8 files changed

+50
-33
lines changed

sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/test/java/com/azure/resourcemanager/fluidrelay/FluidRelayManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.identity.AzurePowerShellCredentialBuilder;
1717
import com.azure.resourcemanager.fluidrelay.models.FluidRelayServer;
1818
import com.azure.resourcemanager.resources.ResourceManager;
19+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
1920
import org.junit.jupiter.api.Assertions;
2021
import org.junit.jupiter.api.Test;
2122

@@ -34,15 +35,16 @@ public void beforeTest() {
3435
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
3536
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
3637

37-
fluidRelayManager = FluidRelayManager.configure()
38-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
39-
.authenticate(credential, profile);
40-
4138
resourceManager = ResourceManager.configure()
4239
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
4340
.authenticate(credential, profile)
4441
.withDefaultSubscription();
4542

43+
fluidRelayManager = FluidRelayManager.configure()
44+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
45+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
46+
.authenticate(credential, profile);
47+
4648
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
4749
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
4850
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/frontdoor/azure-resourcemanager-frontdoor/src/test/java/com/azure/resourcemanager/frontdoor/FrontDoorManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.identity.AzurePowerShellCredentialBuilder;
1717
import com.azure.resourcemanager.frontdoor.models.WebApplicationFirewallPolicy;
1818
import com.azure.resourcemanager.resources.ResourceManager;
19+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
1920
import org.junit.jupiter.api.Assertions;
2021
import org.junit.jupiter.api.Test;
2122

@@ -34,15 +35,16 @@ public void beforeTest() {
3435
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
3536
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
3637

37-
frontDoorManager = FrontDoorManager.configure()
38-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
39-
.authenticate(credential, profile);
40-
4138
resourceManager = ResourceManager.configure()
4239
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
4340
.authenticate(credential, profile)
4441
.withDefaultSubscription();
4542

43+
frontDoorManager = FrontDoorManager.configure()
44+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
45+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
46+
.authenticate(credential, profile);
47+
4648
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
4749
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
4850
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/healthcareapis/azure-resourcemanager-healthcareapis/src/test/java/com/azure/resourcemanager/healthcareapis/HealthcareApisManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.identity.AzurePowerShellCredentialBuilder;
1717
import com.azure.resourcemanager.healthcareapis.models.*;
1818
import com.azure.resourcemanager.resources.ResourceManager;
19+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
1920
import org.junit.jupiter.api.Assertions;
2021
import org.junit.jupiter.api.Test;
2122

@@ -34,15 +35,16 @@ public void beforeTest() {
3435
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
3536
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
3637

37-
healthcareApisManager = HealthcareApisManager.configure()
38-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
39-
.authenticate(credential, profile);
40-
4138
resourceManager = ResourceManager.configure()
4239
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
4340
.authenticate(credential, profile)
4441
.withDefaultSubscription();
4542

43+
healthcareApisManager = HealthcareApisManager.configure()
44+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
45+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
46+
.authenticate(credential, profile);
47+
4648
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
4749
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
4850
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/test/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManagerTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.azure.resourcemanager.msi.MsiManager;
2626
import com.azure.resourcemanager.msi.models.Identity;
2727
import com.azure.resourcemanager.resources.ResourceManager;
28+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
2829
import org.junit.jupiter.api.Assertions;
2930
import org.junit.jupiter.api.Test;
3031

@@ -47,19 +48,21 @@ public void beforeTest() {
4748
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
4849
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
4950

51+
resourceManager = ResourceManager.configure()
52+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
53+
.authenticate(credential, profile)
54+
.withDefaultSubscription();
55+
5056
imageBuilderManager = ImageBuilderManager.configure()
57+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
5158
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
5259
.authenticate(credential, profile);
5360

5461
msiManager = MsiManager.configure()
62+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
5563
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
5664
.authenticate(credential, profile);
5765

58-
resourceManager = ResourceManager.configure()
59-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
60-
.authenticate(credential, profile)
61-
.withDefaultSubscription();
62-
6366
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
6467
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
6568
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/iotcentral/azure-resourcemanager-iotcentral/src/test/java/com/azure/resourcemanager/iotcentral/IotCentralManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity;
2424
import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType;
2525
import com.azure.resourcemanager.resources.ResourceManager;
26+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
2627
import org.junit.jupiter.api.Assertions;
2728
import org.junit.jupiter.api.Test;
2829

@@ -42,15 +43,16 @@ public void beforeTest() {
4243
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
4344
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
4445

45-
iotCentralManager = IotCentralManager.configure()
46-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
47-
.authenticate(credential, profile);
48-
4946
resourceManager = ResourceManager.configure()
5047
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
5148
.authenticate(credential, profile)
5249
.withDefaultSubscription();
5350

51+
iotCentralManager = IotCentralManager.configure()
52+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
53+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
54+
.authenticate(credential, profile);
55+
5456
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
5557
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
5658
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.azure.identity.AzurePowerShellCredentialBuilder;
1717
import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace;
1818
import com.azure.resourcemanager.resources.ResourceManager;
19+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
1920
import org.junit.jupiter.api.Assertions;
2021
import org.junit.jupiter.api.Test;
2122

@@ -34,15 +35,16 @@ public void beforeTest() {
3435
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
3536
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
3637

37-
ioTFirmwareDefenseManager = IoTFirmwareDefenseManager.configure()
38-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
39-
.authenticate(credential, profile);
40-
4138
resourceManager = ResourceManager.configure()
4239
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
4340
.authenticate(credential, profile)
4441
.withDefaultSubscription();
4542

43+
ioTFirmwareDefenseManager = IoTFirmwareDefenseManager.configure()
44+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
45+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
46+
.authenticate(credential, profile);
47+
4648
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
4749
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
4850
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/IotHubManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.azure.resourcemanager.iothub.models.ResourceIdentityType;
3131
import com.azure.resourcemanager.iothub.models.StorageEndpointProperties;
3232
import com.azure.resourcemanager.resources.ResourceManager;
33+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
3334
import io.netty.util.internal.StringUtil;
3435
import org.junit.jupiter.api.Assertions;
3536
import org.junit.jupiter.api.Test;
@@ -54,15 +55,16 @@ public void beforeTest() {
5455
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
5556
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
5657

57-
iotHubManager = IotHubManager.configure()
58-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
59-
.authenticate(credential, profile);
60-
6158
resourceManager = ResourceManager.configure()
6259
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
6360
.authenticate(credential, profile)
6461
.withDefaultSubscription();
6562

63+
iotHubManager = IotHubManager.configure()
64+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
65+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
66+
.authenticate(credential, profile);
67+
6668
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
6769
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
6870
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

sdk/kusto/azure-resourcemanager-kusto/src/test/java/com/azure/resourcemanager/kusto/KustoManagerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.azure.resourcemanager.kusto.models.AzureSkuTier;
2020
import com.azure.resourcemanager.kusto.models.Cluster;
2121
import com.azure.resourcemanager.resources.ResourceManager;
22+
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
2223
import org.junit.jupiter.api.Assertions;
2324
import org.junit.jupiter.api.Test;
2425

@@ -37,15 +38,16 @@ public void beforeTest() {
3738
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
3839
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
3940

40-
kustoManager = KustoManager.configure()
41-
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
42-
.authenticate(credential, profile);
43-
4441
resourceManager = ResourceManager.configure()
4542
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
4643
.authenticate(credential, profile)
4744
.withDefaultSubscription();
4845

46+
kustoManager = KustoManager.configure()
47+
.withPolicy(new ProviderRegistrationPolicy(resourceManager))
48+
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
49+
.authenticate(credential, profile);
50+
4951
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
5052
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
5153
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);

0 commit comments

Comments
 (0)