Skip to content

Commit 0b33ee6

Browse files
sync mgmt sync-stack (#3044)
* sync-stack * fluent settings * sync core * use beta core * fix script * sync core * fix fluent compilation * enable sync-stack for autorest * sync versions * re-generate test code * fix line break * Revert "sync versions" This reverts commit d1a00aa. * sync-versions * sync core * core * re-generate test code * sync core * sync test * disable sync-stack by default * async fix * script fix * sync spotbugs fix * re-generate test code * sync core * add pageable test * sync core * sync test * use java8 for fluent-test * log file removal * add log * more logs * use release instead of source and target * set generation timeout to a higher value * add compilation test --------- Co-authored-by: actions-user <[email protected]>
1 parent 647c830 commit 0b33ee6

File tree

93 files changed

+3921
-2877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3921
-2877
lines changed

azure-dataplane-tests/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/DocumentModelsImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,8 +2433,7 @@ public PagedResponse<DocumentModelSummary> listModelsSinglePage(Context context)
24332433
*/
24342434
@ServiceMethod(returns = ReturnType.COLLECTION)
24352435
public PagedIterable<DocumentModelSummary> listModels() {
2436-
return new PagedIterable<>(() -> listModelsSinglePage(Context.NONE),
2437-
nextLink -> listModelsNextSinglePage(nextLink));
2436+
return new PagedIterable<>(() -> listModelsSinglePage(), nextLink -> listModelsNextSinglePage(nextLink));
24382437
}
24392438

24402439
/**

azure-dataplane-tests/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/MiscellaneousImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public PagedResponse<OperationSummary> listOperationsSinglePage(Context context)
221221
*/
222222
@ServiceMethod(returns = ReturnType.COLLECTION)
223223
public PagedIterable<OperationSummary> listOperations() {
224-
return new PagedIterable<>(() -> listOperationsSinglePage(Context.NONE),
224+
return new PagedIterable<>(() -> listOperationsSinglePage(),
225225
nextLink -> listOperationsNextSinglePage(nextLink));
226226
}
227227

azure-dataplane-tests/src/main/java/com/azure/data/schemaregistry/implementation/SchemaGroupsOperationsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public PagedResponse<String> listSinglePage(Context context) {
204204
*/
205205
@ServiceMethod(returns = ReturnType.COLLECTION)
206206
public PagedIterable<String> list() {
207-
return new PagedIterable<>(() -> listSinglePage(Context.NONE), nextLink -> listNextSinglePage(nextLink));
207+
return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink));
208208
}
209209

210210
/**

azure-dataplane-tests/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ public PagedResponse<Integer> getVersionsSinglePage(String groupName, String sch
586586
*/
587587
@ServiceMethod(returns = ReturnType.COLLECTION)
588588
public PagedIterable<Integer> getVersions(String groupName, String schemaName) {
589-
return new PagedIterable<>(() -> getVersionsSinglePage(groupName, schemaName, Context.NONE),
589+
return new PagedIterable<>(() -> getVersionsSinglePage(groupName, schemaName),
590590
nextLink -> getVersionsNextSinglePage(nextLink));
591591
}
592592

core

Submodule core updated 308 files

fluent-tests/Initialize-Tests.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,25 @@ $job = @(
156156
# empty byte array in client implementation
157157
"--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false --input-file=https://github.com/Azure/azure-rest-api-specs/blob/f840c84013f12b701aac7065ceeb13a59b26051b/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2022-02-05/iotdps.json --java.namespace=com.azure.mgmtlitetest.emptybytearrayinclients"
158158

159+
# sync-stack
160+
# lite
161+
"--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/mediaservices/resource-manager/readme.md --tag=package-account-2023-01 --java.namespace=com.azure.mgmtlitetest.mediaservicessync --enable-sync-stack=true"
162+
# premium
163+
"--version=$AUTOREST_CORE_VERSION $FLUENT_ARGUMENTS --input-file=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8fa9b5051129dd4808c9be1f5b753af226b044db/specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/iothub.json --namespace=com.azure.mgmttest.iothubsync --enable-sync-stack=true"
164+
# special cases
165+
"--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false --input-file=./swagger/sync-stack.json --namespace=com.azure.mgmtlitetest.syncstack --enable-sync-stack=true"
166+
159167
# "--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/network/resource-manager/readme.md --tag=package-2020-06 --java.namespace=com.azure.mgmtlitetest.network"
160168
# "--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/compute/resource-manager/readme.md --tag=package-2020-06-30 --java.namespace=com.azure.mgmtlitetest.compute"
161169
) | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob
162170

163-
$job | Wait-Job -Timeout 360
171+
$job | Wait-Job -Timeout 3600
164172
$job | Receive-Job
165173

166174
# delete module-info as fluent-test is on java8
167175
if (Test-Path ./src/main/java/module-info.java) {
168-
Remove-Item -Path ./src/main/java/module-info.java -Force | Out-Null
176+
Remove-Item -Path ./src/main/java/module-info.java -Force -verbose
177+
$ExitCode = $ExitCode -bor $LASTEXITCODE
169178
}
170179

171180
exit $ExitCode

fluent-tests/gen_all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def codegen(autorest_java: str, specs_dir: str, sdk: str, output_sdk_dir: str) -
6868
'--java.license-header=MICROSOFT_MIT_SMALL',
6969
'--java.output-folder=' + output_sdk_dir,
7070
'--java.namespace=' + namespace,
71+
'--enable-sync-stack=true',
7172
readme_dir]
7273

7374
logging.info(' '.join(command))

fluent-tests/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@
7878
</profile>
7979
</profiles>
8080

81+
<!-- make source and target version Java8 to avoid weird access issues -->
82+
<build>
83+
<pluginManagement>
84+
<plugins>
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-compiler-plugin</artifactId>
88+
<configuration>
89+
<release>8</release>
90+
</configuration>
91+
</plugin>
92+
</plugins>
93+
</pluginManagement>
94+
</build>
95+
8196
<dependencies>
8297
<dependency>
8398
<groupId>com.azure.tools</groupId>

fluent-tests/src/main/java/com/azure/resourcemanager/resources/fluentcore/AzureServiceClient.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
import com.azure.core.management.exception.ManagementException;
1212
import com.azure.core.management.polling.PollerFactory;
1313
import com.azure.core.management.polling.PollResult;
14+
import com.azure.core.management.polling.SyncPollerFactory;
15+
import com.azure.core.util.BinaryData;
1416
import com.azure.core.util.Context;
1517
import com.azure.core.util.CoreUtils;
1618
import com.azure.core.util.polling.AsyncPollResponse;
1719
import com.azure.core.util.polling.LongRunningOperationStatus;
1820
import com.azure.core.util.polling.PollerFlux;
21+
import com.azure.core.util.polling.SyncPoller;
1922
import com.azure.core.util.serializer.SerializerAdapter;
2023
import reactor.core.publisher.Flux;
2124
import reactor.core.publisher.Mono;
@@ -144,6 +147,23 @@ public <T, U> PollerFlux<PollResult<T>, U> getLroResult(Mono<Response<Flux<ByteB
144147
context);
145148
}
146149

150+
/**
151+
* Gets long running operation result.
152+
*
153+
* @param activationResponse the response of activation operation.
154+
* @param pollResultType type of poll result.
155+
* @param finalResultType type of final result.
156+
* @param context the context shared by all requests.
157+
* @param <T> type of poll result.
158+
* @param <U> type of final result.
159+
* @return SyncPoller for poll result and final result.
160+
*/
161+
public <T, U> SyncPoller<PollResult<T>, U> getLroResult(Response<BinaryData> activationResponse,
162+
Type pollResultType, Type finalResultType, Context context) {
163+
return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType,
164+
Duration.ofSeconds(3), () -> activationResponse, context);
165+
}
166+
147167
/**
148168
* Gets the final result, or an error, based on last async poll response.
149169
*

fluent-tests/src/test/java/com/azure/mgmttest/LiteCompilationTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.azure.mgmtlitetest.storage.models.StorageAccounts;
4646
import com.azure.mgmtlitetest.streamanalytics.models.AggregateFunctionProperties;
4747
import com.azure.mgmtlitetest.streamstyleserialization.implementation.CommunityGalleriesClientImpl;
48+
import com.azure.mgmtlitetest.syncstack.SyncStackManager;
4849
import com.azure.mgmttest.azurestack.fluent.models.ExtendedProductInner;
4950
import com.azure.mgmttest.education.fluent.models.LabDetailsInner;
5051
import reactor.core.publisher.Mono;
@@ -220,4 +221,10 @@ public void testChildWithParentFlattenedProperties() {
220221
public void testEmptyByteArrayInClients() {
221222
Class<DpsCertificatesClientImpl> clazz = DpsCertificatesClientImpl.class;
222223
}
224+
225+
public void testSyncStack() {
226+
SyncStackManager syncStackManager = mock(SyncStackManager.class);
227+
syncStackManager.normalPageables().list("name");
228+
syncStackManager.normalPageables().list("name", "filter", Context.NONE);
229+
}
223230
}

0 commit comments

Comments
 (0)