Skip to content

Commit

Permalink
Update to the latest version of up-java (v0.1.9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Petrov committed Apr 9, 2024
1 parent c45f630 commit 28e9043
Show file tree
Hide file tree
Showing 12 changed files with 398 additions and 428 deletions.
2 changes: 1 addition & 1 deletion gradle/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ ext {
namespace : 'org.eclipse.uprotocol.client',
group : 'org.eclipse.uprotocol',
artifact : 'up-client-android-java',
version : '1.5.0',
version : '0.1.2',
]
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ androidx-junit = "1.1.5"
junit = "4.13.2"
mockito = "4.6.1"
robolectric = "4.7.3"
up-java = "1.5.8"
up-java = "0.1.9"

[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
Expand Down
191 changes: 97 additions & 94 deletions library/src/androidTest/java/org/eclipse/uprotocol/UPClientTest.java

Large diffs are not rendered by default.

217 changes: 87 additions & 130 deletions library/src/main/java/org/eclipse/uprotocol/UPClient.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
import static org.eclipse.uprotocol.rpc.RpcMapper.mapResponse;
import static org.eclipse.uprotocol.transport.builder.UPayloadBuilder.packToAny;

import org.eclipse.uprotocol.rpc.CallOptions;
import org.eclipse.uprotocol.rpc.RpcClient;
import org.eclipse.uprotocol.uri.factory.UResourceBuilder;
import org.eclipse.uprotocol.v1.CallOptions;
import org.eclipse.uprotocol.v1.UAuthority;
import org.eclipse.uprotocol.v1.UEntity;
import org.eclipse.uprotocol.v1.UPriority;
import org.eclipse.uprotocol.v1.UStatus;
import org.eclipse.uprotocol.v1.UUri;

Expand All @@ -53,10 +54,15 @@ public class UDiscovery {
public static final String METHOD_UNREGISTER_FOR_NOTIFICATIONS = "UnregisterForNotifications";
public static final String METHOD_RESOLVE_URI = "ResolveUri";

private static final CallOptions DEFAULT_OPTIONS = CallOptions.newBuilder()
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(10_000)
.build();

private UDiscovery() {}

public static UDiscovery.Stub newStub(RpcClient proxy) {
return newStub(proxy, null, CallOptions.DEFAULT);
return newStub(proxy, null, DEFAULT_OPTIONS);
}

public static UDiscovery.Stub newStub(RpcClient proxy, CallOptions options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
import static org.eclipse.uprotocol.rpc.RpcMapper.mapResponse;
import static org.eclipse.uprotocol.transport.builder.UPayloadBuilder.packToAny;

import org.eclipse.uprotocol.rpc.CallOptions;
import org.eclipse.uprotocol.rpc.RpcClient;
import org.eclipse.uprotocol.uri.factory.UResourceBuilder;
import org.eclipse.uprotocol.v1.CallOptions;
import org.eclipse.uprotocol.v1.UAuthority;
import org.eclipse.uprotocol.v1.UEntity;
import org.eclipse.uprotocol.v1.UPriority;
import org.eclipse.uprotocol.v1.UStatus;
import org.eclipse.uprotocol.v1.UUri;

Expand All @@ -52,10 +53,15 @@ public class USubscription {
public static final String METHOD_FETCH_SUBSCRIBERS = "FetchSubscribers";
public static final String METHOD_RESET = "Reset";

private static final CallOptions DEFAULT_OPTIONS = CallOptions.newBuilder()
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(10_000)
.build();

private USubscription() {}

public static Stub newStub(RpcClient proxy) {
return newStub(proxy, null, CallOptions.DEFAULT);
return newStub(proxy, null, DEFAULT_OPTIONS);
}

public static Stub newStub(RpcClient proxy, CallOptions options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC
* SPDX-License-Identifier: Apache-2.0
*/
package org.eclipse.uprotocol.core.utwin.v1;
package org.eclipse.uprotocol.core.utwin.v2;

import static org.eclipse.uprotocol.rpc.RpcMapper.mapResponse;
import static org.eclipse.uprotocol.transport.builder.UPayloadBuilder.packToAny;

import org.eclipse.uprotocol.rpc.CallOptions;
import org.eclipse.uprotocol.rpc.RpcClient;
import org.eclipse.uprotocol.uri.factory.UResourceBuilder;
import org.eclipse.uprotocol.v1.CallOptions;
import org.eclipse.uprotocol.v1.UAuthority;
import org.eclipse.uprotocol.v1.UEntity;
import org.eclipse.uprotocol.v1.UMessage;
import org.eclipse.uprotocol.v1.UPriority;
import org.eclipse.uprotocol.v1.UStatus;
import org.eclipse.uprotocol.v1.UUri;
import org.eclipse.uprotocol.v1.UUriBatch;
Expand All @@ -42,15 +43,20 @@
public class UTwin {
public static final UEntity SERVICE = UEntity.newBuilder()
.setName("core.utwin")
.setVersionMajor(1)
.setVersionMajor(2)
.build();
public static final String METHOD_GET_LAST_MESSAGES = "GetLastMessages";
public static final String METHOD_SET_LAST_MESSAGE = "SetLastMessage";

private static final CallOptions DEFAULT_OPTIONS = CallOptions.newBuilder()
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(10_000)
.build();

private UTwin() {}

public static UTwin.Stub newStub(RpcClient proxy) {
return newStub(proxy, null, CallOptions.DEFAULT);
return newStub(proxy, null, DEFAULT_OPTIONS);
}

public static UTwin.Stub newStub(RpcClient proxy, CallOptions options) {
Expand Down
13 changes: 9 additions & 4 deletions library/src/test/java/org/eclipse/uprotocol/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
import com.google.protobuf.Empty;

import org.eclipse.uprotocol.common.UStatusException;
import org.eclipse.uprotocol.rpc.CallOptions;
import org.eclipse.uprotocol.transport.builder.UAttributesBuilder;
import org.eclipse.uprotocol.uri.factory.UResourceBuilder;
import org.eclipse.uprotocol.uuid.factory.UuidFactory;
import org.eclipse.uprotocol.v1.CallOptions;
import org.eclipse.uprotocol.v1.UAttributes;
import org.eclipse.uprotocol.v1.UAuthority;
import org.eclipse.uprotocol.v1.UCode;
Expand Down Expand Up @@ -131,8 +131,13 @@ public class TestBase {
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG" +
"4gU21pdGgiLCJpYXQiOjE1MTYyMzkwMjJ9.Q_w2AVguPRU2KskCXwR7ZHl09TQXEntfEA8Jj2_Jyew";
protected static final CallOptions OPTIONS = CallOptions.newBuilder()
.withTimeout(TTL)
.withToken(TOKEN)
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(TTL)
.setToken(TOKEN)
.build();
protected static final CallOptions DEFAULT_OPTIONS = CallOptions.newBuilder()
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(10_000)
.build();
protected static final UAttributes ATTRIBUTES = UAttributes.newBuilder()
.setId(ID)
Expand All @@ -142,7 +147,7 @@ public class TestBase {
.setPriority(UPriority.UPRIORITY_CS4)
.setTtl(TTL)
.setPermissionLevel(5)
.setCommstatus(UCode.DEADLINE_EXCEEDED_VALUE)
.setCommstatus(UCode.DEADLINE_EXCEEDED)
.setReqid(ID2)
.setToken(TOKEN)
.build();
Expand Down
Loading

0 comments on commit 28e9043

Please sign in to comment.