Skip to content

Commit

Permalink
mgmt improve test (Azure#14970)
Browse files Browse the repository at this point in the history
* enable test

* fix delay in playback
  • Loading branch information
weidongxu-microsoft authored Sep 10, 2020
1 parent 03fe534 commit c94fcb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public static <T, InnerT> Accepted<T> newAccepted(
activationResponse,
client.getSerializerAdapter(),
client.getHttpPipeline(),
client.getDefaultPollInterval(),
SdkContext.getDelayDuration(client.getDefaultPollInterval()),
innerType, innerType,
convertOperation);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import com.azure.resourcemanager.resources.fluent.inner.DeploymentExtendedInner;
import com.azure.resourcemanager.resources.fluent.inner.DeploymentInner;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;

public class TypeSerializationTests {

@Test
@Disabled("To fix later as swagger changes on DeploymentExtendedInner")
public void testDeploymentSerialization() throws Exception {
final String templateJson = "{ \"/subscriptions/<redacted>/resourceGroups/<redacted>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<redacted>\": {} }";

Expand All @@ -27,11 +27,15 @@ public void testDeploymentSerialization() throws Exception {
Assertions.assertTrue(deploymentJson.contains("Microsoft.ManagedIdentity"));
}

private static DeploymentInner createRequestFromInner(DeploymentImpl deployment) {
private static DeploymentInner createRequestFromInner(DeploymentImpl deployment) throws NoSuchFieldException, IllegalAccessException {
Field field = DeploymentImpl.class.getDeclaredField("deploymentCreateUpdateParameters");
field.setAccessible(true);
DeploymentInner implInner = (DeploymentInner) field.get(deployment);

DeploymentInner inner = new DeploymentInner()
.withProperties(new DeploymentProperties());
inner.properties().withMode(deployment.mode());
//inner.properties().withTemplate(deployment.template());
inner.properties().withTemplate(implInner.properties().template());
inner.properties().withTemplateLink(deployment.templateLink());
inner.properties().withParameters(deployment.parameters());
inner.properties().withParametersLink(deployment.parametersLink());
Expand Down

0 comments on commit c94fcb4

Please sign in to comment.