From 658553b27440f810743767ce8f0e81f57c8d8858 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 15 Jan 2025 11:43:33 +0800 Subject: [PATCH] http-client-java, fix bug on service version in client constructor (#5616) code change https://github.com/microsoft/typespec/pull/5616/commits/039787fc61dad41a14d8dd72ca2a0ea2297c1eb0 later it is unified with branded DPG logic https://github.com/microsoft/typespec/pull/5616/commits/fc5eb9512b0f3f29e97ecd27cf9a6ae87dc4f8e4 --- .../implementation/ApiKeyClientImpl.java | 2 +- .../implementation/CustomClientImpl.java | 2 +- .../implementation/NumericClientImpl.java | 2 +- .../basic/implementation/BasicClientImpl.java | 2 +- .../BodyOptionalityClientImpl.java | 2 +- .../CollectionFormatClientImpl.java | 2 +- .../implementation/SpreadClientImpl.java | 2 +- .../ContentNegotiationClientImpl.java | 2 +- .../JsonMergePatchClientImpl.java | 2 +- .../implementation/MediaTypeClientImpl.java | 2 +- .../implementation/MultiPartClientImpl.java | 2 +- .../implementation/PageableClientImpl.java | 2 +- .../implementation/RoutesClientImpl.java | 2 +- .../json/implementation/JsonClientImpl.java | 2 +- .../implementation/NotDefinedClientImpl.java | 2 +- .../implementation/MultipleClientImpl.java | 4 +- .../implementation/SingleClientImpl.java | 2 +- .../NotVersionedClientImpl.java | 2 +- .../implementation/VersionedClientImpl.java | 4 +- .../SpecialWordsClientImpl.java | 2 +- .../array/implementation/ArrayClientImpl.java | 2 +- .../implementation/DictionaryClientImpl.java | 2 +- .../implementation/ExtensibleClientImpl.java | 2 +- .../fixed/implementation/FixedClientImpl.java | 2 +- .../empty/implementation/EmptyClientImpl.java | 2 +- .../EnumDiscriminatorClientImpl.java | 2 +- .../NestedDiscriminatorClientImpl.java | 2 +- .../NotDiscriminatedClientImpl.java | 2 +- .../implementation/RecursiveClientImpl.java | 2 +- .../SingleDiscriminatorClientImpl.java | 2 +- .../usage/implementation/UsageClientImpl.java | 2 +- .../implementation/VisibilityClientImpl.java | 2 +- .../AdditionalPropertiesClientImpl.java | 2 +- .../implementation/NullableClientImpl.java | 2 +- .../implementation/OptionalClientImpl.java | 2 +- .../implementation/ValueTypesClientImpl.java | 2 +- .../implementation/ScalarClientImpl.java | 2 +- .../union/implementation/UnionClientImpl.java | 2 +- .../added/implementation/AddedClientImpl.java | 4 +- .../MadeOptionalClientImpl.java | 4 +- .../implementation/RemovedClientImpl.java | 4 +- .../implementation/RenamedFromClientImpl.java | 4 +- .../ReturnTypeChangedFromClientImpl.java | 4 +- .../TypeChangedFromClientImpl.java | 4 +- .../core/template/ServiceClientTemplate.java | 72 ++++++++----------- .../operationtemplates/OperationTests.java | 14 ++-- .../typespec/http/client/generator/Main.java | 1 + 47 files changed, 90 insertions(+), 101 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java index 61eef03e7d..96546c56ff 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java @@ -59,8 +59,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public ApiKeyClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(ApiKeyClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java index 9e7301751f..407b00829d 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java @@ -59,8 +59,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public CustomClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(CustomClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java index ea6289a771..7b948c97f6 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java @@ -57,8 +57,8 @@ public PropertiesImpl getProperties() { * @param endpoint Service host. */ public NumericClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.properties = new PropertiesImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java index 331149f99e..b3a500d2f1 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java @@ -71,8 +71,8 @@ public ImplicitBodiesImpl getImplicitBodies() { * @param endpoint Service host. */ public BasicClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.explicitBodies = new ExplicitBodiesImpl(this); this.implicitBodies = new ImplicitBodiesImpl(this); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java index 2cd0636f9f..823ff74cdd 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java @@ -74,8 +74,8 @@ public OptionalExplicitsImpl getOptionalExplicits() { * @param endpoint Service host. */ public BodyOptionalityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.optionalExplicits = new OptionalExplicitsImpl(this); this.service = RestProxy.create(BodyOptionalityClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java index e0caabb4ec..2f6a6afaea 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java @@ -71,8 +71,8 @@ public HeadersImpl getHeaders() { * @param endpoint Service host. */ public CollectionFormatClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.queries = new QueriesImpl(this); this.headers = new HeadersImpl(this); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java index 0fde6cdf22..ad4c2ae70b 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java @@ -71,8 +71,8 @@ public AliasImpl getAlias() { * @param endpoint Service host. */ public SpreadClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.models = new ModelsImpl(this); this.alias = new AliasImpl(this); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java index 47053945ae..65e06ca22a 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java @@ -71,8 +71,8 @@ public DifferentBodiesImpl getDifferentBodies() { * @param endpoint Service host. */ public ContentNegotiationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.sameBodies = new SameBodiesImpl(this); this.differentBodies = new DifferentBodiesImpl(this); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java index 2f4158fc10..f50e3a116e 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public JsonMergePatchClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(JsonMergePatchClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java index ba3bba55ef..a118db6484 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java @@ -57,8 +57,8 @@ public StringBodiesImpl getStringBodies() { * @param endpoint Service host. */ public MediaTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringBodies = new StringBodiesImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java index f49c804b48..6fdcb168a1 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java @@ -99,8 +99,8 @@ public FormDataHttpPartsNonStringsImpl getFormDataHttpPartsNonStrings() { * @param endpoint Service host. */ public MultiPartClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.formDatas = new FormDatasImpl(this); this.formDataHttpParts = new FormDataHttpPartsImpl(this); this.formDataHttpPartsContentTypes = new FormDataHttpPartsContentTypesImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/pageable/implementation/PageableClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/pageable/implementation/PageableClientImpl.java index 69bdcfdb96..89ef559e75 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/pageable/implementation/PageableClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/pageable/implementation/PageableClientImpl.java @@ -57,8 +57,8 @@ public ServerDrivenPaginationsImpl getServerDrivenPaginations() { * @param endpoint Service host. */ public PageableClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.serverDrivenPaginations = new ServerDrivenPaginationsImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/routes/implementation/RoutesClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/routes/implementation/RoutesClientImpl.java index 9e5b8ff921..6783f6b798 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/routes/implementation/RoutesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/routes/implementation/RoutesClientImpl.java @@ -281,8 +281,8 @@ public InInterfacesImpl getInInterfaces() { * @param endpoint Service host. */ public RoutesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.pathParameters = new PathParametersImpl(this); this.pathParametersReservedExpansions = new PathParametersReservedExpansionsImpl(this); this.pathParametersSimpleExpansionStandards = new PathParametersSimpleExpansionStandardsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java index fb0385e3fd..5c4e5eae34 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java @@ -57,8 +57,8 @@ public PropertiesImpl getProperties() { * @param endpoint Service host. */ public JsonClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.properties = new PropertiesImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java index 0611819fe3..b8bec0aff8 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java @@ -57,8 +57,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public NotDefinedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = endpoint; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(NotDefinedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java index 77ecf369ec..8a60f53bc6 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java @@ -74,9 +74,9 @@ public HttpPipeline getHttpPipeline() { * @param serviceVersion Service version. */ public MultipleClientImpl(HttpPipeline httpPipeline, String endpoint, MultipleServiceVersion serviceVersion) { - this.endpoint = endpoint; - this.serviceVersion = MultipleServiceVersion.getLatest(); this.httpPipeline = httpPipeline; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(MultipleClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/single/implementation/SingleClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/single/implementation/SingleClientImpl.java index 1b8890c7b9..b9af536535 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/single/implementation/SingleClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/path/single/implementation/SingleClientImpl.java @@ -57,8 +57,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Need to be set as 'http://localhost:3000' in client. */ public SingleClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = endpoint; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(SingleClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java index 4b3f646883..3fcad4f7bb 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java @@ -59,8 +59,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Need to be set as 'http://localhost:3000' in client. */ public NotVersionedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = endpoint; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(NotVersionedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java index c9b1c64a54..fa41048027 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java @@ -75,9 +75,9 @@ public HttpPipeline getHttpPipeline() { * @param serviceVersion Service version. */ public VersionedClientImpl(HttpPipeline httpPipeline, String endpoint, VersionedServiceVersion serviceVersion) { - this.endpoint = endpoint; - this.serviceVersion = VersionedServiceVersion.getLatest(); this.httpPipeline = httpPipeline; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(VersionedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java index edb8baf2c9..0bddb97581 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java @@ -99,8 +99,8 @@ public ParametersImpl getParameters() { * @param endpoint Service host. */ public SpecialWordsClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.models = new ModelsImpl(this); this.modelProperties = new ModelPropertiesImpl(this); this.operations = new OperationsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/array/implementation/ArrayClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/array/implementation/ArrayClientImpl.java index 45588e290d..d15b17978a 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/array/implementation/ArrayClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/array/implementation/ArrayClientImpl.java @@ -239,8 +239,8 @@ public NullableModelValuesImpl getNullableModelValues() { * @param endpoint Service host. */ public ArrayClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.int32Values = new Int32ValuesImpl(this); this.int64Values = new Int64ValuesImpl(this); this.booleanValues = new BooleanValuesImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java index 9d608b9630..2459ee5d7b 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java @@ -197,8 +197,8 @@ public NullableFloatValuesImpl getNullableFloatValues() { * @param endpoint Service host. */ public DictionaryClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.int32Values = new Int32ValuesImpl(this); this.int64Values = new Int64ValuesImpl(this); this.booleanValues = new BooleanValuesImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java index 10dfffe731..42af640af4 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java @@ -57,8 +57,8 @@ public StringOperationsImpl getStringOperations() { * @param endpoint Service host. */ public ExtensibleClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringOperations = new StringOperationsImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java index 6d3bf50e90..afc6d87793 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java @@ -57,8 +57,8 @@ public StringOperationsImpl getStringOperations() { * @param endpoint Service host. */ public FixedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringOperations = new StringOperationsImpl(this); } } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java index c3a2eae6c0..648add7bb2 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public EmptyClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(EmptyClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java index db3c37a2c7..f41ca69465 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public EnumDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(EnumDiscriminatorClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java index 3511fc97e1..0e90b0835b 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java @@ -61,8 +61,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public NestedDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(NestedDiscriminatorClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java index 73ef7b384c..7cbe838df3 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java @@ -61,8 +61,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public NotDiscriminatedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(NotDiscriminatedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java index 6cf964f101..77f55a36bc 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java @@ -61,8 +61,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public RecursiveClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(RecursiveClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java index 5721c42879..461207dedd 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public SingleDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(SingleDiscriminatorClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java index 597e579f5e..8b37ee52b2 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public UsageClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(UsageClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java index 91f50336f7..379d2583f1 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java @@ -62,8 +62,8 @@ public HttpPipeline getHttpPipeline() { * @param endpoint Service host. */ public VisibilityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.service = RestProxy.create(VisibilityClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java index 26d9f17f8d..a6266d18d4 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java @@ -491,8 +491,8 @@ public SpreadRecordNonDiscriminatedUnion3sImpl getSpreadRecordNonDiscriminatedUn * @param endpoint Service host. */ public AdditionalPropertiesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.extendsUnknowns = new ExtendsUnknownsImpl(this); this.extendsUnknownDeriveds = new ExtendsUnknownDerivedsImpl(this); this.extendsUnknownDiscriminateds = new ExtendsUnknownDiscriminatedsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java index 64674a77c9..6e7d16ed48 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java @@ -141,8 +141,8 @@ public CollectionsStringsImpl getCollectionsStrings() { * @param endpoint Service host. */ public NullableClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringOperations = new StringOperationsImpl(this); this.bytes = new BytesImpl(this); this.datetimeOperations = new DatetimeOperationsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java index 783652d62c..b860724f38 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java @@ -267,8 +267,8 @@ public RequiredAndOptionalsImpl getRequiredAndOptionals() { * @param endpoint Service host. */ public OptionalClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringOperations = new StringOperationsImpl(this); this.bytes = new BytesImpl(this); this.datetimeOperations = new DatetimeOperationsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java index fa8ab53c37..4cf0979af5 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java @@ -449,8 +449,8 @@ public UnionEnumValuesImpl getUnionEnumValues() { * @param endpoint Service host. */ public ValueTypesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.booleanOperations = new BooleanOperationsImpl(this); this.stringOperations = new StringOperationsImpl(this); this.bytes = new BytesImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java index 7dbe8df1d9..b6a3b1b595 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java @@ -141,8 +141,8 @@ public Decimal128VerifiesImpl getDecimal128Verifies() { * @param endpoint Service host. */ public ScalarClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringOperations = new StringOperationsImpl(this); this.booleanOperations = new BooleanOperationsImpl(this); this.unknowns = new UnknownsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/union/implementation/UnionClientImpl.java index 02ae532d04..57fa7cc227 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/union/implementation/UnionClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/type/union/implementation/UnionClientImpl.java @@ -183,8 +183,8 @@ public MixedTypesImpl getMixedTypes() { * @param endpoint Service host. */ public UnionClientImpl(HttpPipeline httpPipeline, String endpoint) { - this.endpoint = "http://localhost:3000"; this.httpPipeline = httpPipeline; + this.endpoint = endpoint; this.stringsOnlies = new StringsOnliesImpl(this); this.stringExtensibles = new StringExtensiblesImpl(this); this.stringExtensibleNameds = new StringExtensibleNamedsImpl(this); diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/added/implementation/AddedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/added/implementation/AddedClientImpl.java index 41935a4491..efc6f69bb8 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/added/implementation/AddedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/added/implementation/AddedClientImpl.java @@ -109,10 +109,10 @@ public InterfaceV2sImpl getInterfaceV2s() { */ public AddedClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, AddedServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = AddedServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.interfaceV2s = new InterfaceV2sImpl(this); this.service = RestProxy.create(AddedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java index 203daafb3f..d272e1f684 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java @@ -94,10 +94,10 @@ public HttpPipeline getHttpPipeline() { */ public MadeOptionalClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, MadeOptionalServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = MadeOptionalServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(MadeOptionalClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java index 266609fc7a..e3c69f9867 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java @@ -95,10 +95,10 @@ public HttpPipeline getHttpPipeline() { */ public RemovedClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, RemovedServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = RemovedServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(RemovedClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java index e27ec85f1a..87071d7dec 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java @@ -109,10 +109,10 @@ public NewInterfacesImpl getNewInterfaces() { */ public RenamedFromClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, RenamedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = RenamedFromServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.newInterfaces = new NewInterfacesImpl(this); this.service = RestProxy.create(RenamedFromClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java index 5bd4bf4492..9db39af03d 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java @@ -93,10 +93,10 @@ public HttpPipeline getHttpPipeline() { */ public ReturnTypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, ReturnTypeChangedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = ReturnTypeChangedFromServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(ReturnTypeChangedFromClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java index e1d8ac1ae5..3e2e434baf 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java @@ -95,10 +95,10 @@ public HttpPipeline getHttpPipeline() { */ public TypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, Versions version, TypeChangedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; this.endpoint = endpoint; this.version = version; - this.serviceVersion = TypeChangedFromServiceVersion.getLatest(); - this.httpPipeline = httpPipeline; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(TypeChangedFromClientService.class, this.httpPipeline); } diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ServiceClientTemplate.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ServiceClientTemplate.java index 7a2895d282..a70c882beb 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ServiceClientTemplate.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ServiceClientTemplate.java @@ -203,26 +203,8 @@ public final void write(ServiceClient serviceClient, JavaFile javaFile) { if (!settings.isBranded()) { if (constructor.getParameters() .equals(Arrays.asList(serviceClient.getHttpPipelineParameter()))) { - for (ServiceClientProperty serviceClientProperty : serviceClient.getProperties() - .stream() - .collect(Collectors.toList())) { - if (serviceClientProperty.getDefaultValueExpression() != null) { - constructorBlock.line("this.%s = %s;", serviceClientProperty.getName(), - serviceClientProperty.getDefaultValueExpression()); - } else { - constructorBlock.line("this.%s = %s;", serviceClientProperty.getName(), - serviceClientProperty.getName()); - } - } - - for (MethodGroupClient methodGroupClient : serviceClient.getMethodGroupClients()) { - constructorBlock.line("this.%s = new %s(this);", - methodGroupClient.getVariableName(), methodGroupClient.getClassName()); - } - - if (serviceClient.getProxy() != null) { - TemplateHelper.createRestProxyInstance(this, serviceClient, constructorBlock); - } + writeMaxOverloadedDataPlaneConstructorImplementation(constructorBlock, serviceClient, + constructorParametersCodes); } } else if (settings.isFluent()) { if (constructor.getParameters() @@ -280,28 +262,8 @@ public final void write(ServiceClient serviceClient, JavaFile javaFile) { } else if (constructor.getParameters() .equals(Arrays.asList(serviceClient.getHttpPipelineParameter(), serviceClient.getSerializerAdapterParameter()))) { - constructorBlock.line("this.httpPipeline = httpPipeline;"); - writeSerializerMemberInitialization(constructorBlock); - constructorParametersCodes.accept(constructorBlock); - - for (ServiceClientProperty serviceClientProperty : serviceClient.getProperties() - .stream() - .filter(ServiceClientProperty::isReadOnly) - .collect(Collectors.toList())) { - if (serviceClientProperty.getDefaultValueExpression() != null) { - constructorBlock.line("this.%s = %s;", serviceClientProperty.getName(), - serviceClientProperty.getDefaultValueExpression()); - } - } - - for (MethodGroupClient methodGroupClient : serviceClient.getMethodGroupClients()) { - constructorBlock.line("this.%s = new %s(this);", - methodGroupClient.getVariableName(), methodGroupClient.getClassName()); - } - - if (serviceClient.getProxy() != null) { - TemplateHelper.createRestProxyInstance(this, serviceClient, constructorBlock); - } + writeMaxOverloadedDataPlaneConstructorImplementation(constructorBlock, serviceClient, + constructorParametersCodes); } } }); @@ -424,4 +386,30 @@ private static String getAdditionalConstructorArguments(ServiceClient serviceCli } return constructorArgs; } + + private void writeMaxOverloadedDataPlaneConstructorImplementation(JavaBlock constructorBlock, + ServiceClient serviceClient, Consumer constructorParametersCodes) { + constructorBlock.line("this.httpPipeline = httpPipeline;"); + writeSerializerMemberInitialization(constructorBlock); + constructorParametersCodes.accept(constructorBlock); + + for (ServiceClientProperty serviceClientProperty : serviceClient.getProperties() + .stream() + .filter(ServiceClientProperty::isReadOnly) + .collect(Collectors.toList())) { + if (serviceClientProperty.getDefaultValueExpression() != null) { + constructorBlock.line("this.%s = %s;", serviceClientProperty.getName(), + serviceClientProperty.getDefaultValueExpression()); + } + } + + for (MethodGroupClient methodGroupClient : serviceClient.getMethodGroupClients()) { + constructorBlock.line("this.%s = new %s(this);", methodGroupClient.getVariableName(), + methodGroupClient.getClassName()); + } + + if (serviceClient.getProxy() != null) { + TemplateHelper.createRestProxyInstance(this, serviceClient, constructorBlock); + } + } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java index 76c8744cc0..9373449d2c 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java @@ -10,13 +10,12 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.Region; import com.azure.core.management.profile.AzureProfile; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.utils.ArmUtils; - import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; import java.time.Duration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; public class OperationTests { private final OperationTemplatesManager manager = buildManager(); @@ -44,10 +43,11 @@ public void testLro() { // for LRO operations, we need to override default poll interval private static OperationTemplatesManager buildManager() { try { - Constructor constructor - = OperationTemplatesManager.class.getDeclaredConstructor(HttpPipeline.class, AzureProfile.class, Duration.class); + Constructor constructor = OperationTemplatesManager.class + .getDeclaredConstructor(HttpPipeline.class, AzureProfile.class, Duration.class); setAccessible(constructor); - return constructor.newInstance(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile(), Duration.ofMillis(1)); + return constructor.newInstance(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile(), + Duration.ofMillis(1)); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java index b0a6137870..4d65d994de 100644 --- a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java +++ b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/Main.java @@ -43,6 +43,7 @@ public class Main { private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); private static final String DEFAULT_OUTPUT_DIR = "http-client-generator-test/tsp-output/"; + // private static final String DEFAULT_OUTPUT_DIR = "http-client-generator-clientcore-test/tsp-output/"; private static Yaml yaml = null;