Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/storagemover/azure-resourcemanager-storagemover",
"Tag": "java/storagemover/azure-resourcemanager-storagemover_afaadc7d3b"
}
18 changes: 18 additions & 0 deletions sdk/storagemover/azure-resourcemanager-storagemover/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@
<version>2.54.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-resources;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-network</artifactId>
<version>2.58.2</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-network;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-authorization</artifactId>
<version>2.53.9</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-authorization;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-storage</artifactId>
<version>2.56.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-storage;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-test</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.storagemover.scenario;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
* Mirrors {@code AgentTests.cs} from the .NET source-of-truth test suite.
*
* <p>The single {@code GetExistTest} method is skipped in every language port
* because Storage Mover agents cannot be created via the RP — they self-register
* from a real VM. See {@code storage-mover-scenario-tests-cross-language} task
* note for the rationale shared across .NET, Python, JS, Go, and Java.
*/
public class AgentTests extends StorageMoverManagementTestBase {

@Test
@Disabled("Agents cannot be created by the RP; this test requires a registered agent VM.")
public void getExist() {
// Body intentionally empty — see @Disabled reason. The .NET reference
// exercises agent get / list / patch (uploadLimitWeeklyRecurrences) on
// a pre-existing agent named "testagent1", which is impossible to set
// up hermetically.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.storagemover.scenario;

import com.azure.core.management.Region;
import com.azure.resourcemanager.storagemover.models.Connection;
import com.azure.resourcemanager.storagemover.models.ConnectionProperties;
import com.azure.resourcemanager.storagemover.models.StorageMover;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.stream.StreamSupport;

/**
* Mirrors {@code ConnectionTests.cs} from the .NET source-of-truth (row #32 of
* the cross-language matrix). Exercises Connection CRUD against the shared
* private-link service {@code test-pls-wcs}.
*
* <p>Operates in {@code westcentralus} because the upstream PLS is deployed
* there; the per-test resource group is provisioned in the same region so
* private endpoint provisioning stays in-region.
*
* <p>This test intentionally does not assert on {@code connectionStatus} —
* PLS provisioning is asynchronous and the status starts as {@code Pending}.
* The status assertion lives in the C2C-with-private-source scenario (row
* #31) where the PE is explicitly approved.
*
* <p>The {@code description} field on update is also intentionally not asserted
* to equal the new value — the RP echoes the stale (create-time) description
* for several seconds after a PATCH and the assertion would be flaky across
* languages (Python and JS hit the same behaviour).
*/
public class ConnectionTests extends StorageMoverManagementTestBase {

@Override
protected Region testRegion() {
return WEST_CENTRAL_US;
}

@Test
public void createGetListUpdateDelete() {
String storageMoverName = generateRandomResourceName("stomover-conn-", 24);
String connectionName = generateRandomResourceName("conn-", 24);

StorageMover sm = storageMoverManager.storageMovers()
.define(storageMoverName)
.withRegion(testRegion())
.withExistingResourceGroup(resourceGroupName)
.create();

try {
Connection created = storageMoverManager.connections()
.define(connectionName)
.withExistingStorageMover(resourceGroupName, sm.name())
.withProperties(new ConnectionProperties().withDescription("initial description")
.withPrivateLinkServiceId(PRIVATE_LINK_SERVICE_ID))
.create();
Assertions.assertEquals(connectionName, created.name());
Assertions.assertNotNull(created.properties());
Assertions.assertEquals("initial description", created.properties().description());
// The body-key sanitizer registered in the base redacts the
// subscription segment of $..privateLinkServiceId to all-zeros, so
// assert only the resource-group + name suffix (which is what the
// round-trip actually verifies). The sub segment is identical in
// record and playback after sanitization.
String expectedPlsSuffix = "/resourceGroups/" + PRIVATE_LINK_SERVICE_RG
+ "/providers/Microsoft.Network/privateLinkServices/" + PRIVATE_LINK_SERVICE_NAME;
Assertions.assertNotNull(created.properties().privateLinkServiceId());
Assertions.assertTrue(created.properties().privateLinkServiceId().endsWith(expectedPlsSuffix),
"expected privateLinkServiceId to end with " + expectedPlsSuffix + " but was "
+ created.properties().privateLinkServiceId());

Connection fetched = storageMoverManager.connections().get(resourceGroupName, sm.name(), connectionName);
Assertions.assertEquals(connectionName, fetched.name());
Assertions.assertNotNull(fetched.properties().privateLinkServiceId());
Assertions.assertTrue(fetched.properties().privateLinkServiceId().endsWith(expectedPlsSuffix),
"expected fetched privateLinkServiceId to end with " + expectedPlsSuffix + " but was "
+ fetched.properties().privateLinkServiceId());

boolean foundConnection = StreamSupport
.stream(storageMoverManager.connections().list(resourceGroupName, sm.name()).spliterator(), false)
.anyMatch(c -> connectionName.equals(c.name()));
Assertions.assertTrue(foundConnection,
"expected connection " + connectionName + " in list but it was not found");

// Update keeps the same PLS id (cannot be changed post-create) and
// changes only the description. The new description is intentionally
// NOT asserted because the RP echoes the create-time value for several
// seconds after the PATCH (cross-language flakiness — see playbook).
Connection updated = fetched.update()
.withProperties(new ConnectionProperties().withDescription("updated description")
.withPrivateLinkServiceId(PRIVATE_LINK_SERVICE_ID))
.apply();
Assertions.assertEquals(connectionName, updated.name());

Connection refreshed = updated.refresh();
Assertions.assertEquals(connectionName, refreshed.name());

storageMoverManager.connections().delete(resourceGroupName, sm.name(), connectionName);
assertNotFound(() -> storageMoverManager.connections().get(resourceGroupName, sm.name(), connectionName));
} finally {
// Best-effort cleanup in case the test failed before the explicit
// delete above. Idempotent — delete on a missing resource is a 204.
try {
storageMoverManager.connections().delete(resourceGroupName, sm.name(), connectionName);
} catch (RuntimeException ignored) {
// already deleted or never created.
}
}
}
}
Loading