Remove server-side tracking of "supports SMS." Nobody does!
// FREEBIE
This commit is contained in:
parent
53bdd946d6
commit
75ee398633
|
@ -285,7 +285,6 @@ public class AccountController {
|
||||||
|
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setNumber(number);
|
account.setNumber(number);
|
||||||
account.setSupportsSms(accountAttributes.getSupportsSms());
|
|
||||||
account.addDevice(device);
|
account.addDevice(device);
|
||||||
|
|
||||||
accounts.create(account);
|
accounts.create(account);
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class FederationControllerV1 extends FederationController {
|
||||||
|
|
||||||
for (Account account : accountList) {
|
for (Account account : accountList) {
|
||||||
byte[] token = Util.getContactToken(account.getNumber());
|
byte[] token = Util.getContactToken(account.getNumber());
|
||||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
ClientContact clientContact = new ClientContact(token, null);
|
||||||
|
|
||||||
if (!account.isActive()) {
|
if (!account.isActive()) {
|
||||||
clientContact.setInactive(true);
|
clientContact.setInactive(true);
|
||||||
|
|
|
@ -25,9 +25,6 @@ public class AccountAttributes {
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
private String signalingKey;
|
private String signalingKey;
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
private boolean supportsSms;
|
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private boolean fetchesMessages;
|
private boolean fetchesMessages;
|
||||||
|
|
||||||
|
@ -36,9 +33,8 @@ public class AccountAttributes {
|
||||||
|
|
||||||
public AccountAttributes() {}
|
public AccountAttributes() {}
|
||||||
|
|
||||||
public AccountAttributes(String signalingKey, boolean supportsSms, boolean fetchesMessages, int registrationId) {
|
public AccountAttributes(String signalingKey, boolean fetchesMessages, int registrationId) {
|
||||||
this.signalingKey = signalingKey;
|
this.signalingKey = signalingKey;
|
||||||
this.supportsSms = supportsSms;
|
|
||||||
this.fetchesMessages = fetchesMessages;
|
this.fetchesMessages = fetchesMessages;
|
||||||
this.registrationId = registrationId;
|
this.registrationId = registrationId;
|
||||||
}
|
}
|
||||||
|
@ -47,10 +43,6 @@ public class AccountAttributes {
|
||||||
return signalingKey;
|
return signalingKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSupportsSms() {
|
|
||||||
return supportsSms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getFetchesMessages() {
|
public boolean getFetchesMessages() {
|
||||||
return fetchesMessages;
|
return fetchesMessages;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,10 @@ public class ClientContact {
|
||||||
|
|
||||||
private String relay;
|
private String relay;
|
||||||
private boolean inactive;
|
private boolean inactive;
|
||||||
private boolean supportsSms;
|
|
||||||
|
|
||||||
public ClientContact(byte[] token, String relay, boolean supportsSms) {
|
public ClientContact(byte[] token, String relay) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.relay = relay;
|
this.relay = relay;
|
||||||
this.supportsSms = supportsSms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientContact() {}
|
public ClientContact() {}
|
||||||
|
@ -56,10 +54,6 @@ public class ClientContact {
|
||||||
this.relay = relay;
|
this.relay = relay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSupportsSms() {
|
|
||||||
return supportsSms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInactive() {
|
public boolean isInactive() {
|
||||||
return inactive;
|
return inactive;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +75,6 @@ public class ClientContact {
|
||||||
|
|
||||||
return
|
return
|
||||||
Arrays.equals(this.token, that.token) &&
|
Arrays.equals(this.token, that.token) &&
|
||||||
this.supportsSms == that.supportsSms &&
|
|
||||||
this.inactive == that.inactive &&
|
this.inactive == that.inactive &&
|
||||||
(this.relay == null ? (that.relay == null) : this.relay.equals(that.relay));
|
(this.relay == null ? (that.relay == null) : this.relay.equals(that.relay));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,6 @@ public class Account {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private String number;
|
private String number;
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
private boolean supportsSms;
|
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private Set<Device> devices = new HashSet<>();
|
private Set<Device> devices = new HashSet<>();
|
||||||
|
|
||||||
|
@ -47,10 +44,9 @@ public class Account {
|
||||||
public Account() {}
|
public Account() {}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public Account(String number, boolean supportsSms, Set<Device> devices) {
|
public Account(String number, Set<Device> devices) {
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.supportsSms = supportsSms;
|
this.devices = devices;
|
||||||
this.devices = devices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Device> getAuthenticatedDevice() {
|
public Optional<Device> getAuthenticatedDevice() {
|
||||||
|
@ -69,14 +65,6 @@ public class Account {
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSupportsSms() {
|
|
||||||
return supportsSms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupportsSms(boolean supportsSms) {
|
|
||||||
this.supportsSms = supportsSms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDevice(Device device) {
|
public void addDevice(Device device) {
|
||||||
this.devices.remove(device);
|
this.devices.remove(device);
|
||||||
this.devices.add(device);
|
this.devices.add(device);
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class AccountsManager {
|
||||||
private void updateDirectory(Account account) {
|
private void updateDirectory(Account account) {
|
||||||
if (account.isActive()) {
|
if (account.isActive()) {
|
||||||
byte[] token = Util.getContactToken(account.getNumber());
|
byte[] token = Util.getContactToken(account.getNumber());
|
||||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
ClientContact clientContact = new ClientContact(token, null);
|
||||||
directory.add(clientContact);
|
directory.add(clientContact);
|
||||||
} else {
|
} else {
|
||||||
directory.remove(account.getNumber());
|
directory.remove(account.getNumber());
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class DirectoryManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(ClientContact contact) {
|
public void add(ClientContact contact) {
|
||||||
TokenValue tokenValue = new TokenValue(contact.getRelay(), contact.isSupportsSms());
|
TokenValue tokenValue = new TokenValue(contact.getRelay());
|
||||||
|
|
||||||
try (Jedis jedis = redisPool.getResource()) {
|
try (Jedis jedis = redisPool.getResource()) {
|
||||||
jedis.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
jedis.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
||||||
|
@ -84,7 +84,7 @@ public class DirectoryManager {
|
||||||
public void add(BatchOperationHandle handle, ClientContact contact) {
|
public void add(BatchOperationHandle handle, ClientContact contact) {
|
||||||
try {
|
try {
|
||||||
Pipeline pipeline = handle.pipeline;
|
Pipeline pipeline = handle.pipeline;
|
||||||
TokenValue tokenValue = new TokenValue(contact.getRelay(), contact.isSupportsSms());
|
TokenValue tokenValue = new TokenValue(contact.getRelay());
|
||||||
|
|
||||||
pipeline.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
pipeline.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
@ -106,7 +106,7 @@ public class DirectoryManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
||||||
return Optional.of(new ClientContact(token, tokenValue.relay, tokenValue.supportsSms));
|
return Optional.of(new ClientContact(token, tokenValue.relay));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("JSON Error", e);
|
logger.warn("JSON Error", e);
|
||||||
return Optional.absent();
|
return Optional.absent();
|
||||||
|
@ -133,7 +133,7 @@ public class DirectoryManager {
|
||||||
try {
|
try {
|
||||||
if (pair.second().get() != null) {
|
if (pair.second().get() != null) {
|
||||||
TokenValue tokenValue = objectMapper.readValue(pair.second().get(), TokenValue.class);
|
TokenValue tokenValue = objectMapper.readValue(pair.second().get(), TokenValue.class);
|
||||||
ClientContact clientContact = new ClientContact(pair.first(), tokenValue.relay, tokenValue.supportsSms);
|
ClientContact clientContact = new ClientContact(pair.first(), tokenValue.relay);
|
||||||
|
|
||||||
results.add(clientContact);
|
results.add(clientContact);
|
||||||
}
|
}
|
||||||
|
@ -175,14 +175,10 @@ public class DirectoryManager {
|
||||||
@JsonProperty(value = "r")
|
@JsonProperty(value = "r")
|
||||||
private String relay;
|
private String relay;
|
||||||
|
|
||||||
@JsonProperty(value = "s")
|
|
||||||
private boolean supportsSms;
|
|
||||||
|
|
||||||
public TokenValue() {}
|
public TokenValue() {}
|
||||||
|
|
||||||
public TokenValue(String relay, boolean supportsSms) {
|
public TokenValue(String relay) {
|
||||||
this.relay = relay;
|
this.relay = relay;
|
||||||
this.supportsSms = supportsSms;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +201,7 @@ public class DirectoryManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
||||||
return Optional.of(new ClientContact(token, tokenValue.relay, tokenValue.supportsSms));
|
return Optional.of(new ClientContact(token, tokenValue.relay));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class DirectoryUpdater {
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
if (account.isActive()) {
|
if (account.isActive()) {
|
||||||
byte[] token = Util.getContactToken(account.getNumber());
|
byte[] token = Util.getContactToken(account.getNumber());
|
||||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
ClientContact clientContact = new ClientContact(token, null);
|
||||||
|
|
||||||
directory.add(batchOperation, clientContact);
|
directory.add(batchOperation, clientContact);
|
||||||
contactsAdded++;
|
contactsAdded++;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/code/%s", "1234"))
|
resources.client().resource(String.format("/v1/accounts/code/%s", "1234"))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 2222))
|
.entity(new AccountAttributes("keykeykeykey", false, 2222))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/code/%s", "1111"))
|
resources.client().resource(String.format("/v1/accounts/code/%s", "1111"))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 3333))
|
.entity(new AccountAttributes("keykeykeykey", false, 3333))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader("+14151111111", "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader("+14151111111", "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class AccountControllerTest {
|
||||||
ClientResponse response =
|
ClientResponse response =
|
||||||
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
resources.client().resource(String.format("/v1/accounts/token/%s", token))
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, false, 4444))
|
.entity(new AccountAttributes("keykeykeykey", false, 4444))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(ClientResponse.class);
|
.put(ClientResponse.class);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class DeviceControllerTest {
|
||||||
|
|
||||||
DeviceResponse response = resources.client().resource("/v1/devices/5678901")
|
DeviceResponse response = resources.client().resource("/v1/devices/5678901")
|
||||||
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
|
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
|
||||||
.entity(new AccountAttributes("keykeykeykey", false, true, 1234))
|
.entity(new AccountAttributes("keykeykeykey", false, 1234))
|
||||||
.type(MediaType.APPLICATION_JSON_TYPE)
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.put(DeviceResponse.class);
|
.put(DeviceResponse.class);
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class FederatedControllerTest {
|
||||||
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||||
|
|
||||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class MessageControllerTest {
|
||||||
add(new Device(3, "foo", "bar", "baz", "isgcm", null, null, false, 444, null, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(31)));
|
add(new Device(3, "foo", "bar", "baz", "isgcm", null, null, false, 444, null, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(31)));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||||
|
|
||||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||||
|
|
|
@ -55,8 +55,8 @@ public class ReceiptControllerTest {
|
||||||
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
add(new Device(2, "foo", "bar", "baz", "isgcm", null, null, false, 333, null, System.currentTimeMillis()));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, false, singleDeviceList);
|
Account singleDeviceAccount = new Account(SINGLE_DEVICE_RECIPIENT, singleDeviceList);
|
||||||
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, false, multiDeviceList);
|
Account multiDeviceAccount = new Account(MULTI_DEVICE_RECIPIENT, multiDeviceList);
|
||||||
|
|
||||||
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
when(accountsManager.get(eq(SINGLE_DEVICE_RECIPIENT))).thenReturn(Optional.of(singleDeviceAccount));
|
||||||
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
when(accountsManager.get(eq(MULTI_DEVICE_RECIPIENT))).thenReturn(Optional.of(multiDeviceAccount));
|
||||||
|
|
|
@ -17,9 +17,9 @@ public class ClientContactTest {
|
||||||
@Test
|
@Test
|
||||||
public void serializeToJSON() throws Exception {
|
public void serializeToJSON() throws Exception {
|
||||||
byte[] token = Util.getContactToken("+14152222222");
|
byte[] token = Util.getContactToken("+14152222222");
|
||||||
ClientContact contact = new ClientContact(token, null, false);
|
ClientContact contact = new ClientContact(token, null);
|
||||||
ClientContact contactWithRelay = new ClientContact(token, "whisper", false);
|
ClientContact contactWithRelay = new ClientContact(token, "whisper");
|
||||||
ClientContact contactWithRelaySms = new ClientContact(token, "whisper", true );
|
ClientContact contactWithRelaySms = new ClientContact(token, "whisper");
|
||||||
|
|
||||||
assertThat("Basic Contact Serialization works",
|
assertThat("Basic Contact Serialization works",
|
||||||
asJson(contact),
|
asJson(contact),
|
||||||
|
@ -28,19 +28,15 @@ public class ClientContactTest {
|
||||||
assertThat("Contact Relay Serialization works",
|
assertThat("Contact Relay Serialization works",
|
||||||
asJson(contactWithRelay),
|
asJson(contactWithRelay),
|
||||||
is(equalTo(jsonFixture("fixtures/contact.relay.json"))));
|
is(equalTo(jsonFixture("fixtures/contact.relay.json"))));
|
||||||
|
|
||||||
assertThat("Contact Relay+SMS Serialization works",
|
|
||||||
asJson(contactWithRelaySms),
|
|
||||||
is(equalTo(jsonFixture("fixtures/contact.relay.sms.json"))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deserializeFromJSON() throws Exception {
|
public void deserializeFromJSON() throws Exception {
|
||||||
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
||||||
"whisper", true);
|
"whisper");
|
||||||
|
|
||||||
assertThat("a ClientContact can be deserialized from JSON",
|
assertThat("a ClientContact can be deserialized from JSON",
|
||||||
fromJson(jsonFixture("fixtures/contact.relay.sms.json"), ClientContact.class),
|
fromJson(jsonFixture("fixtures/contact.relay.json"), ClientContact.class),
|
||||||
is(contact));
|
is(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ public class PreKeyTest {
|
||||||
@Test
|
@Test
|
||||||
public void deserializeFromJSONV() throws Exception {
|
public void deserializeFromJSONV() throws Exception {
|
||||||
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
ClientContact contact = new ClientContact(Util.getContactToken("+14152222222"),
|
||||||
"whisper", true);
|
"whisper");
|
||||||
|
|
||||||
assertThat("a ClientContact can be deserialized from JSON",
|
assertThat("a ClientContact can be deserialized from JSON",
|
||||||
fromJson(jsonFixture("fixtures/contact.relay.sms.json"), ClientContact.class),
|
fromJson(jsonFixture("fixtures/contact.relay.json"), ClientContact.class),
|
||||||
is(contact));
|
is(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"relay" : "whisper",
|
|
||||||
"supportsSms" : true,
|
|
||||||
"token" : "BQVVHxMt5zAFXA"
|
|
||||||
}
|
|
Loading…
Reference in New Issue