-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test that sets non default values for all the kotlin flags.
- Loading branch information
1 parent
f68b9be
commit 2921d96
Showing
7 changed files
with
421 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
wire-tests/src/commonTest/proto/kotlin/service_kotlin_with_all_flags.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2019 Square Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package squareup.protos.kotlin; | ||
|
||
option java_package = "com.squareup.wire.protos.kotlin.services.all_flags_on"; | ||
|
||
message SomeRequest {} | ||
message SomeResponse {} | ||
|
||
service SomeService { | ||
rpc SomeMethod (SomeRequest) returns (SomeResponse); | ||
} |
86 changes: 86 additions & 0 deletions
86
...ropTest/proto-kotlin/com/squareup/wire/protos/kotlin/services/all_flags_on/SomeRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Code generated by Wire protocol buffer compiler, do not edit. | ||
// Source: squareup.protos.kotlin.SomeRequest in service_kotlin_with_all_flags.proto | ||
package com.squareup.wire.protos.kotlin.services.all_flags_on | ||
|
||
import com.squareup.wire.FieldEncoding | ||
import com.squareup.wire.Message | ||
import com.squareup.wire.ProtoAdapter | ||
import com.squareup.wire.ProtoReader | ||
import com.squareup.wire.ProtoWriter | ||
import com.squareup.wire.ReverseProtoWriter | ||
import com.squareup.wire.Syntax.PROTO_2 | ||
import com.squareup.wire.`internal`.JvmField | ||
import kotlin.Any | ||
import kotlin.Boolean | ||
import kotlin.Int | ||
import kotlin.Long | ||
import kotlin.String | ||
import okio.ByteString | ||
|
||
public class SomeRequest internal constructor( | ||
unknownFields: ByteString = ByteString.EMPTY, | ||
) : Message<SomeRequest, SomeRequest.Builder>(ADAPTER, unknownFields) { | ||
override fun newBuilder(): Builder { | ||
val builder = Builder() | ||
builder.addUnknownFields(unknownFields) | ||
return builder | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (other === this) return true | ||
if (other !is SomeRequest) return false | ||
if (unknownFields != other.unknownFields) return false | ||
return true | ||
} | ||
|
||
override fun hashCode(): Int = unknownFields.hashCode() | ||
|
||
override fun toString(): String = "SomeRequest{}" | ||
|
||
public fun copy(unknownFields: ByteString = this.unknownFields): SomeRequest = | ||
SomeRequest(unknownFields) | ||
|
||
public class Builder : Message.Builder<SomeRequest, Builder>() { | ||
override fun build(): SomeRequest = SomeRequest( | ||
unknownFields = buildUnknownFields() | ||
) | ||
} | ||
|
||
public companion object { | ||
@JvmField | ||
public val ADAPTER: ProtoAdapter<SomeRequest> = object : ProtoAdapter<SomeRequest>( | ||
FieldEncoding.LENGTH_DELIMITED, | ||
SomeRequest::class, | ||
"type.googleapis.com/squareup.protos.kotlin.SomeRequest", | ||
PROTO_2, | ||
null, | ||
"service_kotlin_with_all_flags.proto" | ||
) { | ||
override fun encodedSize(`value`: SomeRequest): Int { | ||
var size = value.unknownFields.size | ||
return size | ||
} | ||
|
||
override fun encode(writer: ProtoWriter, `value`: SomeRequest) { | ||
writer.writeBytes(value.unknownFields) | ||
} | ||
|
||
override fun encode(writer: ReverseProtoWriter, `value`: SomeRequest) { | ||
writer.writeBytes(value.unknownFields) | ||
} | ||
|
||
override fun decode(reader: ProtoReader): SomeRequest { | ||
val unknownFields = reader.forEachTag(reader::readUnknownField) | ||
return SomeRequest( | ||
unknownFields = unknownFields | ||
) | ||
} | ||
|
||
override fun redact(`value`: SomeRequest): SomeRequest = value.copy( | ||
unknownFields = ByteString.EMPTY | ||
) | ||
} | ||
|
||
private const val serialVersionUID: Long = 0L | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
...opTest/proto-kotlin/com/squareup/wire/protos/kotlin/services/all_flags_on/SomeResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Code generated by Wire protocol buffer compiler, do not edit. | ||
// Source: squareup.protos.kotlin.SomeResponse in service_kotlin_with_all_flags.proto | ||
package com.squareup.wire.protos.kotlin.services.all_flags_on | ||
|
||
import com.squareup.wire.FieldEncoding | ||
import com.squareup.wire.Message | ||
import com.squareup.wire.ProtoAdapter | ||
import com.squareup.wire.ProtoReader | ||
import com.squareup.wire.ProtoWriter | ||
import com.squareup.wire.ReverseProtoWriter | ||
import com.squareup.wire.Syntax.PROTO_2 | ||
import com.squareup.wire.`internal`.JvmField | ||
import kotlin.Any | ||
import kotlin.Boolean | ||
import kotlin.Int | ||
import kotlin.Long | ||
import kotlin.String | ||
import okio.ByteString | ||
|
||
public class SomeResponse internal constructor( | ||
unknownFields: ByteString = ByteString.EMPTY, | ||
) : Message<SomeResponse, SomeResponse.Builder>(ADAPTER, unknownFields) { | ||
override fun newBuilder(): Builder { | ||
val builder = Builder() | ||
builder.addUnknownFields(unknownFields) | ||
return builder | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (other === this) return true | ||
if (other !is SomeResponse) return false | ||
if (unknownFields != other.unknownFields) return false | ||
return true | ||
} | ||
|
||
override fun hashCode(): Int = unknownFields.hashCode() | ||
|
||
override fun toString(): String = "SomeResponse{}" | ||
|
||
public fun copy(unknownFields: ByteString = this.unknownFields): SomeResponse = | ||
SomeResponse(unknownFields) | ||
|
||
public class Builder : Message.Builder<SomeResponse, Builder>() { | ||
override fun build(): SomeResponse = SomeResponse( | ||
unknownFields = buildUnknownFields() | ||
) | ||
} | ||
|
||
public companion object { | ||
@JvmField | ||
public val ADAPTER: ProtoAdapter<SomeResponse> = object : ProtoAdapter<SomeResponse>( | ||
FieldEncoding.LENGTH_DELIMITED, | ||
SomeResponse::class, | ||
"type.googleapis.com/squareup.protos.kotlin.SomeResponse", | ||
PROTO_2, | ||
null, | ||
"service_kotlin_with_all_flags.proto" | ||
) { | ||
override fun encodedSize(`value`: SomeResponse): Int { | ||
var size = value.unknownFields.size | ||
return size | ||
} | ||
|
||
override fun encode(writer: ProtoWriter, `value`: SomeResponse) { | ||
writer.writeBytes(value.unknownFields) | ||
} | ||
|
||
override fun encode(writer: ReverseProtoWriter, `value`: SomeResponse) { | ||
writer.writeBytes(value.unknownFields) | ||
} | ||
|
||
override fun decode(reader: ProtoReader): SomeResponse { | ||
val unknownFields = reader.forEachTag(reader::readUnknownField) | ||
return SomeResponse( | ||
unknownFields = unknownFields | ||
) | ||
} | ||
|
||
override fun redact(`value`: SomeResponse): SomeResponse = value.copy( | ||
unknownFields = ByteString.EMPTY | ||
) | ||
} | ||
|
||
private const val serialVersionUID: Long = 0L | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../com/squareup/wire/protos/kotlin/services/all_flags_on/SomeServiceSomeMethodSomeSuffix.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Code generated by Wire protocol buffer compiler, do not edit. | ||
// Source: squareup.protos.kotlin.SomeService in service_kotlin_with_all_flags.proto | ||
package com.squareup.wire.protos.kotlin.services.all_flags_on | ||
|
||
import com.squareup.wire.Service | ||
import com.squareup.wire.WireRpc | ||
|
||
public interface SomeServiceSomeMethodSomeSuffix : Service { | ||
@WireRpc( | ||
path = "/squareup.protos.kotlin.SomeService/SomeMethod", | ||
requestAdapter = "com.squareup.wire.protos.kotlin.services.all_flags_on.SomeRequest#ADAPTER", | ||
responseAdapter = "com.squareup.wire.protos.kotlin.services.all_flags_on.SomeResponse#ADAPTER", | ||
sourceFile = "service_kotlin_with_all_flags.proto", | ||
) | ||
public fun SomeMethod(request: SomeRequest): SomeResponse | ||
} |
Oops, something went wrong.