diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md index 6073b25d8825..4f4fce54ee96 100644 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2023-03-06) + +- Azure Resource Manager voiceservices client library for Java. This package contains Microsoft Azure SDK for voiceservices Management SDK. Package tag package-2023-01-31. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md index 69519c59dfb1..c9ed3d58cead 100644 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-voiceservices - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md index a223257ea247..e33d8785297b 100644 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md @@ -214,7 +214,7 @@ public final class NameAvailabilityCheckLocalSamples { "useast", new CheckNameAvailabilityRequest() .withName("myname") - .withType("Microsoft.VoiceServices/CommunicationsGateway"), + .withType("Microsoft.VoiceServices/CommunicationsGateways"), com.azure.core.util.Context.NONE); } } diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java index b9406ea568e7..8bd421373a34 100644 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java @@ -24,7 +24,7 @@ public static void checkLocalNameAvailability( "useast", new CheckNameAvailabilityRequest() .withName("myname") - .withType("Microsoft.VoiceServices/CommunicationsGateway"), + .withType("Microsoft.VoiceServices/CommunicationsGateways"), com.azure.core.util.Context.NONE); } } diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityRequestTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityRequestTests.java deleted file mode 100644 index 50ce84b7f894..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityRequestTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = - BinaryData - .fromString("{\"name\":\"peqfpjkjl\",\"type\":\"fpdvhpfxxypi\"}") - .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("peqfpjkjl", model.name()); - Assertions.assertEquals("fpdvhpfxxypi", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityRequest model = - new CheckNameAvailabilityRequest().withName("peqfpjkjl").withType("fpdvhpfxxypi"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("peqfpjkjl", model.name()); - Assertions.assertEquals("fpdvhpfxxypi", model.type()); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityResponseInnerTests.java deleted file mode 100644 index e3898ef484f9..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CheckNameAvailabilityResponseInnerTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; -import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityReason; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityResponseInner model = - BinaryData - .fromString("{\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"huyb\"}") - .toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); - Assertions.assertEquals("huyb", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityResponseInner model = - new CheckNameAvailabilityResponseInner() - .withNameAvailable(true) - .withReason(CheckNameAvailabilityReason.INVALID) - .withMessage("huyb"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); - Assertions.assertEquals("huyb", model.message()); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewayUpdateTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewayUpdateTests.java deleted file mode 100644 index 2c4319e37930..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewayUpdateTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.CommunicationsGatewayUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CommunicationsGatewayUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CommunicationsGatewayUpdate model = - BinaryData - .fromString("{\"tags\":{\"vamih\":\"odepoogin\",\"vyevcciqi\":\"ognarxzxtheotus\"}}") - .toObject(CommunicationsGatewayUpdate.class); - Assertions.assertEquals("odepoogin", model.tags().get("vamih")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CommunicationsGatewayUpdate model = - new CommunicationsGatewayUpdate().withTags(mapOf("vamih", "odepoogin", "vyevcciqi", "ognarxzxtheotus")); - model = BinaryData.fromObject(model).toObject(CommunicationsGatewayUpdate.class); - Assertions.assertEquals("odepoogin", model.tags().get("vamih")); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteMockTests.java deleted file mode 100644 index 1a6385b8bad2..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CommunicationsGatewaysDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.communicationsGateways().delete("itnwuizgazxufi", "uckyf", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilitiesCheckLocalWithResponseMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilitiesCheckLocalWithResponseMockTests.java deleted file mode 100644 index c7ef2caf2be4..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilitiesCheckLocalWithResponseMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; -import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityResponse; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class NameAvailabilitiesCheckLocalWithResponseMockTests { - @Test - public void testCheckLocalWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"dcuf\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CheckNameAvailabilityResponse response = - manager - .nameAvailabilities() - .checkLocalWithResponse( - "sdkf", - new CheckNameAvailabilityRequest().withName("wxmnteiwao").withType("km"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(false, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); - Assertions.assertEquals("dcuf", response.message()); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationDisplayTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationDisplayTests.java deleted file mode 100644 index 93111cca30f0..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationDisplayTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationInnerTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationInnerTests.java deleted file mode 100644 index b0a3442b178c..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.fluent.models.OperationInner; -import com.azure.resourcemanager.voiceservices.models.OperationDisplay; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationListResultTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationListResultTests.java deleted file mode 100644 index 390cdb1cae60..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationsListMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationsListMockTests.java deleted file mode 100644 index c7806d1095fa..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/OperationsListMockTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import com.azure.resourcemanager.voiceservices.models.Operation; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"jfddgmbmbe\",\"isDataAction\":true,\"display\":{\"provider\":\"tq\",\"resource\":\"ol\",\"operation\":\"fpsalgbqu\",\"description\":\"gjyjgzjaoyfhrtxi\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/PrimaryRegionPropertiesTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/PrimaryRegionPropertiesTests.java deleted file mode 100644 index b8205e9d00b4..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/PrimaryRegionPropertiesTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.PrimaryRegionProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrimaryRegionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrimaryRegionProperties model = - BinaryData - .fromString( - "{\"operatorAddresses\":[\"bcryffdfd\",\"sy\",\"expa\",\"jakhmsbzjh\"],\"esrpAddresses\":[\"evdphlxaol\",\"hqtrgqjbpf\"],\"allowedSignalingSourceAddressPrefixes\":[\"inzgvfcj\"],\"allowedMediaSourceAddressPrefixes\":[\"oxxjtfelluwf\",\"it\"]}") - .toObject(PrimaryRegionProperties.class); - Assertions.assertEquals("bcryffdfd", model.operatorAddresses().get(0)); - Assertions.assertEquals("evdphlxaol", model.esrpAddresses().get(0)); - Assertions.assertEquals("inzgvfcj", model.allowedSignalingSourceAddressPrefixes().get(0)); - Assertions.assertEquals("oxxjtfelluwf", model.allowedMediaSourceAddressPrefixes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrimaryRegionProperties model = - new PrimaryRegionProperties() - .withOperatorAddresses(Arrays.asList("bcryffdfd", "sy", "expa", "jakhmsbzjh")) - .withEsrpAddresses(Arrays.asList("evdphlxaol", "hqtrgqjbpf")) - .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("inzgvfcj")) - .withAllowedMediaSourceAddressPrefixes(Arrays.asList("oxxjtfelluwf", "it")); - model = BinaryData.fromObject(model).toObject(PrimaryRegionProperties.class); - Assertions.assertEquals("bcryffdfd", model.operatorAddresses().get(0)); - Assertions.assertEquals("evdphlxaol", model.esrpAddresses().get(0)); - Assertions.assertEquals("inzgvfcj", model.allowedSignalingSourceAddressPrefixes().get(0)); - Assertions.assertEquals("oxxjtfelluwf", model.allowedMediaSourceAddressPrefixes().get(0)); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/ServiceRegionPropertiesTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/ServiceRegionPropertiesTests.java deleted file mode 100644 index c2e07d7ab3cd..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/ServiceRegionPropertiesTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.PrimaryRegionProperties; -import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ServiceRegionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServiceRegionProperties model = - BinaryData - .fromString( - "{\"name\":\"pjoxzjnch\",\"primaryRegionProperties\":{\"operatorAddresses\":[\"jspodmailzyde\",\"o\",\"wyahuxinpmqnja\"],\"esrpAddresses\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"allowedSignalingSourceAddressPrefixes\":[\"rwfndiod\"],\"allowedMediaSourceAddressPrefixes\":[\"lwejdpv\",\"ryo\",\"psoacctazakljl\"]}}") - .toObject(ServiceRegionProperties.class); - Assertions.assertEquals("pjoxzjnch", model.name()); - Assertions.assertEquals("jspodmailzyde", model.primaryRegionProperties().operatorAddresses().get(0)); - Assertions.assertEquals("xj", model.primaryRegionProperties().esrpAddresses().get(0)); - Assertions - .assertEquals("rwfndiod", model.primaryRegionProperties().allowedSignalingSourceAddressPrefixes().get(0)); - Assertions.assertEquals("lwejdpv", model.primaryRegionProperties().allowedMediaSourceAddressPrefixes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServiceRegionProperties model = - new ServiceRegionProperties() - .withName("pjoxzjnch") - .withPrimaryRegionProperties( - new PrimaryRegionProperties() - .withOperatorAddresses(Arrays.asList("jspodmailzyde", "o", "wyahuxinpmqnja")) - .withEsrpAddresses(Arrays.asList("xj", "prozvcputegjvwmf", "atscmd", "pjhulsuuvmkj")) - .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("rwfndiod")) - .withAllowedMediaSourceAddressPrefixes(Arrays.asList("lwejdpv", "ryo", "psoacctazakljl"))); - model = BinaryData.fromObject(model).toObject(ServiceRegionProperties.class); - Assertions.assertEquals("pjoxzjnch", model.name()); - Assertions.assertEquals("jspodmailzyde", model.primaryRegionProperties().operatorAddresses().get(0)); - Assertions.assertEquals("xj", model.primaryRegionProperties().esrpAddresses().get(0)); - Assertions - .assertEquals("rwfndiod", model.primaryRegionProperties().allowedSignalingSourceAddressPrefixes().get(0)); - Assertions.assertEquals("lwejdpv", model.primaryRegionProperties().allowedMediaSourceAddressPrefixes().get(0)); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineInnerTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineInnerTests.java deleted file mode 100644 index 39a16cc80822..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineInnerTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class TestLineInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TestLineInner model = - BinaryData - .fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"phoneNumber\":\"ypnddhsgcb\",\"purpose\":\"Manual\"},\"location\":\"hejkotynqgou\",\"tags\":{\"gakeqsr\":\"dlikwyqkgfgibma\",\"qqedqytbciqfou\":\"yb\"},\"id\":\"lmmnkzsmodmglo\",\"name\":\"gpbkwtmut\",\"type\":\"uqktap\"}") - .toObject(TestLineInner.class); - Assertions.assertEquals("hejkotynqgou", model.location()); - Assertions.assertEquals("dlikwyqkgfgibma", model.tags().get("gakeqsr")); - Assertions.assertEquals("ypnddhsgcb", model.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, model.purpose()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TestLineInner model = - new TestLineInner() - .withLocation("hejkotynqgou") - .withTags(mapOf("gakeqsr", "dlikwyqkgfgibma", "qqedqytbciqfou", "yb")) - .withPhoneNumber("ypnddhsgcb") - .withPurpose(TestLinePurpose.MANUAL); - model = BinaryData.fromObject(model).toObject(TestLineInner.class); - Assertions.assertEquals("hejkotynqgou", model.location()); - Assertions.assertEquals("dlikwyqkgfgibma", model.tags().get("gakeqsr")); - Assertions.assertEquals("ypnddhsgcb", model.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, model.purpose()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineListResultTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineListResultTests.java deleted file mode 100644 index 38efe5b29754..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineListResultTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; -import com.azure.resourcemanager.voiceservices.models.TestLineListResult; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class TestLineListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TestLineListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"phoneNumber\":\"gbwjzrnf\",\"purpose\":\"Manual\"},\"location\":\"gispemvtzfkufubl\",\"tags\":{\"v\":\"xqeofjaeqjhqjba\",\"zgcwrw\":\"smjqulngsntnbyb\"},\"id\":\"lxxwrljdouskc\",\"name\":\"vkocrcjdkwtn\",\"type\":\"xbnjbiksq\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"phoneNumber\":\"sainqpjwnzl\",\"purpose\":\"Manual\"},\"location\":\"mppeebvmgxs\",\"tags\":{\"jczdzevndh\":\"yqduujit\",\"feusnhut\":\"rwpdappdsbdkvwrw\",\"xhocdgeablgphuti\":\"eltmrldhugjzzdat\"},\"id\":\"ndv\",\"name\":\"aozwyiftyhxhu\",\"type\":\"okftyxolniwpwcuk\"}],\"nextLink\":\"kgiawxklryplwck\"}") - .toObject(TestLineListResult.class); - Assertions.assertEquals("gispemvtzfkufubl", model.value().get(0).location()); - Assertions.assertEquals("xqeofjaeqjhqjba", model.value().get(0).tags().get("v")); - Assertions.assertEquals("gbwjzrnf", model.value().get(0).phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, model.value().get(0).purpose()); - Assertions.assertEquals("kgiawxklryplwck", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TestLineListResult model = - new TestLineListResult() - .withValue( - Arrays - .asList( - new TestLineInner() - .withLocation("gispemvtzfkufubl") - .withTags(mapOf("v", "xqeofjaeqjhqjba", "zgcwrw", "smjqulngsntnbyb")) - .withPhoneNumber("gbwjzrnf") - .withPurpose(TestLinePurpose.MANUAL), - new TestLineInner() - .withLocation("mppeebvmgxs") - .withTags( - mapOf( - "jczdzevndh", - "yqduujit", - "feusnhut", - "rwpdappdsbdkvwrw", - "xhocdgeablgphuti", - "eltmrldhugjzzdat")) - .withPhoneNumber("sainqpjwnzl") - .withPurpose(TestLinePurpose.MANUAL))) - .withNextLink("kgiawxklryplwck"); - model = BinaryData.fromObject(model).toObject(TestLineListResult.class); - Assertions.assertEquals("gispemvtzfkufubl", model.value().get(0).location()); - Assertions.assertEquals("xqeofjaeqjhqjba", model.value().get(0).tags().get("v")); - Assertions.assertEquals("gbwjzrnf", model.value().get(0).phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, model.value().get(0).purpose()); - Assertions.assertEquals("kgiawxklryplwck", model.nextLink()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinePropertiesTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinePropertiesTests.java deleted file mode 100644 index 79dd7b715676..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinePropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.fluent.models.TestLineProperties; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import org.junit.jupiter.api.Assertions; - -public final class TestLinePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TestLineProperties model = - BinaryData - .fromString("{\"provisioningState\":\"Failed\",\"phoneNumber\":\"gcue\",\"purpose\":\"Automated\"}") - .toObject(TestLineProperties.class); - Assertions.assertEquals("gcue", model.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.AUTOMATED, model.purpose()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TestLineProperties model = - new TestLineProperties().withPhoneNumber("gcue").withPurpose(TestLinePurpose.AUTOMATED); - model = BinaryData.fromObject(model).toObject(TestLineProperties.class); - Assertions.assertEquals("gcue", model.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.AUTOMATED, model.purpose()); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineUpdateTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineUpdateTests.java deleted file mode 100644 index bfd6cf4d2732..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLineUpdateTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.voiceservices.models.TestLineUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class TestLineUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TestLineUpdate model = - BinaryData.fromString("{\"tags\":{\"bmdg\":\"kdosvqw\"}}").toObject(TestLineUpdate.class); - Assertions.assertEquals("kdosvqw", model.tags().get("bmdg")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TestLineUpdate model = new TestLineUpdate().withTags(mapOf("bmdg", "kdosvqw")); - model = BinaryData.fromObject(model).toObject(TestLineUpdate.class); - Assertions.assertEquals("kdosvqw", model.tags().get("bmdg")); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateMockTests.java deleted file mode 100644 index eb79df457e76..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import com.azure.resourcemanager.voiceservices.models.TestLine; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TestLinesCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"phoneNumber\":\"icxm\",\"purpose\":\"Manual\"},\"location\":\"wqvhkhixuigdt\",\"tags\":{\"m\":\"objoghmewu\"},\"id\":\"uhrzayvvt\",\"name\":\"gvdfgiotkftutq\",\"type\":\"ln\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TestLine response = - manager - .testLines() - .define("dkexxppofm") - .withRegion("exhd") - .withExistingCommunicationsGateway("ctbzaq", "qsycbkbfkgu") - .withTags(mapOf("jnxqbzvddntwn", "bqe")) - .withPhoneNumber("fjpgddtocjjxhvp") - .withPurpose(TestLinePurpose.MANUAL) - .create(); - - Assertions.assertEquals("wqvhkhixuigdt", response.location()); - Assertions.assertEquals("objoghmewu", response.tags().get("m")); - Assertions.assertEquals("icxm", response.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, response.purpose()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteMockTests.java deleted file mode 100644 index 0f6b93a54699..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TestLinesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .testLines() - .delete("jionpimexgstxgc", "odgmaajrmvdjwz", "lovmclwhijcoe", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetWithResponseMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetWithResponseMockTests.java deleted file mode 100644 index a1ecddb1f120..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetWithResponseMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import com.azure.resourcemanager.voiceservices.models.TestLine; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TestLinesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"phoneNumber\":\"c\",\"purpose\":\"Manual\"},\"location\":\"ljavbqid\",\"tags\":{\"dj\":\"jzyulpk\",\"xzlocxscp\":\"rlkhbzhfepgzgq\"},\"id\":\"ierhhbcsglummaj\",\"name\":\"j\",\"type\":\"odxobnbdxkqpxok\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TestLine response = - manager - .testLines() - .getWithResponse("bznorcjxvsnby", "qabnmoc", "cyshurzafbljjgp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ljavbqid", response.location()); - Assertions.assertEquals("jzyulpk", response.tags().get("dj")); - Assertions.assertEquals("c", response.phoneNumber()); - Assertions.assertEquals(TestLinePurpose.MANUAL, response.purpose()); - } -} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewayMockTests.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewayMockTests.java deleted file mode 100644 index 4fbaddc64fde..000000000000 --- a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/test/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewayMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.voiceservices.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.voiceservices.VoiceservicesManager; -import com.azure.resourcemanager.voiceservices.models.TestLine; -import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TestLinesListByCommunicationsGatewayMockTests { - @Test - public void testListByCommunicationsGateway() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"phoneNumber\":\"sne\",\"purpose\":\"Automated\"},\"location\":\"wzjeiach\",\"tags\":{\"eeh\":\"sflnrosfqp\",\"swjdkirso\":\"zvypyqrimzinp\"},\"id\":\"dqxhcrmnohjtckwh\",\"name\":\"soifiyipjxsqw\",\"type\":\"gr\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - VoiceservicesManager manager = - VoiceservicesManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager - .testLines() - .listByCommunicationsGateway("fsrpymzidnse", "cxtbzsg", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("wzjeiach", response.iterator().next().location()); - Assertions.assertEquals("sflnrosfqp", response.iterator().next().tags().get("eeh")); - Assertions.assertEquals("sne", response.iterator().next().phoneNumber()); - Assertions.assertEquals(TestLinePurpose.AUTOMATED, response.iterator().next().purpose()); - } -}