Test fixes and improvements
This commit is contained in:
parent
016b4f80ba
commit
841fb7eccd
@ -439,9 +439,7 @@ public class Plaintext implements Streamable {
|
|||||||
|
|
||||||
public void addLabels(Collection<Label> labels) {
|
public void addLabels(Collection<Label> labels) {
|
||||||
if (labels != null) {
|
if (labels != null) {
|
||||||
for (Label label : labels) {
|
this.labels.addAll(labels);
|
||||||
this.labels.add(label);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +538,7 @@ public class Plaintext implements Streamable {
|
|||||||
private byte[] ackData;
|
private byte[] ackData;
|
||||||
private byte[] ackMessage;
|
private byte[] ackMessage;
|
||||||
private byte[] signature;
|
private byte[] signature;
|
||||||
private long sent;
|
private Long sent;
|
||||||
private Long received;
|
private Long received;
|
||||||
private Status status;
|
private Status status;
|
||||||
private Set<Label> labels = new LinkedHashSet<>();
|
private Set<Label> labels = new LinkedHashSet<>();
|
||||||
@ -665,12 +663,12 @@ public class Plaintext implements Streamable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder sent(long sent) {
|
public Builder sent(Long sent) {
|
||||||
this.sent = sent;
|
this.sent = sent;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder received(long received) {
|
public Builder received(Long received) {
|
||||||
this.received = received;
|
this.received = received;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,11 @@ import ch.dissem.bitmessage.entity.payload.ObjectType;
|
|||||||
import ch.dissem.bitmessage.entity.payload.Pubkey;
|
import ch.dissem.bitmessage.entity.payload.Pubkey;
|
||||||
import ch.dissem.bitmessage.entity.valueobject.InventoryVector;
|
import ch.dissem.bitmessage.entity.valueobject.InventoryVector;
|
||||||
import ch.dissem.bitmessage.ports.*;
|
import ch.dissem.bitmessage.ports.*;
|
||||||
|
import ch.dissem.bitmessage.testutils.TestInventory;
|
||||||
import ch.dissem.bitmessage.utils.MessageMatchers;
|
import ch.dissem.bitmessage.utils.MessageMatchers;
|
||||||
import ch.dissem.bitmessage.utils.Singleton;
|
import ch.dissem.bitmessage.utils.Singleton;
|
||||||
import ch.dissem.bitmessage.utils.TTL;
|
import ch.dissem.bitmessage.utils.TTL;
|
||||||
import ch.dissem.bitmessage.utils.TestUtils;
|
import ch.dissem.bitmessage.utils.TestUtils;
|
||||||
import org.hamcrest.BaseMatcher;
|
|
||||||
import org.hamcrest.Description;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -51,15 +50,18 @@ import static org.mockito.Mockito.*;
|
|||||||
public class BitmessageContextTest {
|
public class BitmessageContextTest {
|
||||||
private BitmessageContext ctx;
|
private BitmessageContext ctx;
|
||||||
private BitmessageContext.Listener listener;
|
private BitmessageContext.Listener listener;
|
||||||
|
private TestInventory testInventory;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
Singleton.initialize(null);
|
Singleton.initialize(null);
|
||||||
listener = mock(BitmessageContext.Listener.class);
|
listener = mock(BitmessageContext.Listener.class);
|
||||||
|
Singleton.initialize(new BouncyCryptography());
|
||||||
|
testInventory = new TestInventory();
|
||||||
ctx = new BitmessageContext.Builder()
|
ctx = new BitmessageContext.Builder()
|
||||||
.addressRepo(mock(AddressRepository.class))
|
.addressRepo(mock(AddressRepository.class))
|
||||||
.cryptography(new BouncyCryptography())
|
.cryptography(cryptography())
|
||||||
.inventory(mock(Inventory.class))
|
.inventory(spy(testInventory))
|
||||||
.listener(listener)
|
.listener(listener)
|
||||||
.messageRepo(mock(MessageRepository.class))
|
.messageRepo(mock(MessageRepository.class))
|
||||||
.networkHandler(mock(NetworkHandler.class))
|
.networkHandler(mock(NetworkHandler.class))
|
||||||
@ -134,11 +136,19 @@ public class BitmessageContextTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensureV2PubkeyIsNotRequestedIfItExistsInInventory() throws Exception {
|
public void ensureV2PubkeyIsNotRequestedIfItExistsInInventory() throws Exception {
|
||||||
|
testInventory.init(
|
||||||
|
"V1Msg.payload",
|
||||||
|
"V2GetPubkey.payload",
|
||||||
|
"V2Pubkey.payload",
|
||||||
|
"V3GetPubkey.payload",
|
||||||
|
"V3Pubkey.payload",
|
||||||
|
"V4Broadcast.payload",
|
||||||
|
"V4GetPubkey.payload",
|
||||||
|
"V4Pubkey.payload",
|
||||||
|
"V5Broadcast.payload"
|
||||||
|
);
|
||||||
BitmessageAddress contact = new BitmessageAddress("BM-opWQhvk9xtMFvQA2Kvetedpk8LkbraWHT");
|
BitmessageAddress contact = new BitmessageAddress("BM-opWQhvk9xtMFvQA2Kvetedpk8LkbraWHT");
|
||||||
when(ctx.internals().getInventory().getObjects(anyLong(), anyLong(), any(ObjectType.class)))
|
|
||||||
.thenReturn(Collections.singletonList(
|
|
||||||
TestUtils.loadObjectMessage(2, "V2Pubkey.payload")
|
|
||||||
));
|
|
||||||
when(ctx.addresses().getAddress(contact.getAddress())).thenReturn(contact);
|
when(ctx.addresses().getAddress(contact.getAddress())).thenReturn(contact);
|
||||||
|
|
||||||
ctx.addContact(contact);
|
ctx.addContact(contact);
|
||||||
@ -150,11 +160,18 @@ public class BitmessageContextTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensureV4PubkeyIsNotRequestedIfItExistsInInventory() throws Exception {
|
public void ensureV4PubkeyIsNotRequestedIfItExistsInInventory() throws Exception {
|
||||||
|
testInventory.init(
|
||||||
|
"V1Msg.payload",
|
||||||
|
"V2GetPubkey.payload",
|
||||||
|
"V2Pubkey.payload",
|
||||||
|
"V3GetPubkey.payload",
|
||||||
|
"V3Pubkey.payload",
|
||||||
|
"V4Broadcast.payload",
|
||||||
|
"V4GetPubkey.payload",
|
||||||
|
"V4Pubkey.payload",
|
||||||
|
"V5Broadcast.payload"
|
||||||
|
);
|
||||||
BitmessageAddress contact = new BitmessageAddress("BM-2cXxfcSetKnbHJX2Y85rSkaVpsdNUZ5q9h");
|
BitmessageAddress contact = new BitmessageAddress("BM-2cXxfcSetKnbHJX2Y85rSkaVpsdNUZ5q9h");
|
||||||
when(ctx.internals().getInventory().getObjects(anyLong(), anyLong(), any(ObjectType.class)))
|
|
||||||
.thenReturn(Collections.singletonList(
|
|
||||||
TestUtils.loadObjectMessage(2, "V4Pubkey.payload")
|
|
||||||
));
|
|
||||||
final BitmessageAddress stored = new BitmessageAddress(contact.getAddress());
|
final BitmessageAddress stored = new BitmessageAddress(contact.getAddress());
|
||||||
stored.setAlias("Test");
|
stored.setAlias("Test");
|
||||||
when(ctx.addresses().getAddress(contact.getAddress())).thenReturn(stored);
|
when(ctx.addresses().getAddress(contact.getAddress())).thenReturn(stored);
|
||||||
@ -170,13 +187,12 @@ public class BitmessageContextTest {
|
|||||||
public void ensureSubscriptionIsAddedAndExistingBroadcastsRetrieved() throws Exception {
|
public void ensureSubscriptionIsAddedAndExistingBroadcastsRetrieved() throws Exception {
|
||||||
BitmessageAddress address = new BitmessageAddress("BM-2D9Vc5rFxxR5vTi53T9gkLfemViHRMVLQZ");
|
BitmessageAddress address = new BitmessageAddress("BM-2D9Vc5rFxxR5vTi53T9gkLfemViHRMVLQZ");
|
||||||
|
|
||||||
List<ObjectMessage> objects = new LinkedList<>();
|
testInventory.init(
|
||||||
objects.add(TestUtils.loadObjectMessage(4, "V4Broadcast.payload"));
|
"V4Broadcast.payload",
|
||||||
objects.add(TestUtils.loadObjectMessage(5, "V5Broadcast.payload"));
|
"V5Broadcast.payload"
|
||||||
when(ctx.internals().getInventory().getObjects(eq(address.getStream()), anyLong(), any(ObjectType.class)))
|
);
|
||||||
.thenReturn(objects);
|
|
||||||
when(ctx.addresses().getSubscriptions(anyLong())).thenReturn(Collections.singletonList(address));
|
|
||||||
|
|
||||||
|
when(ctx.addresses().getSubscriptions(anyLong())).thenReturn(Collections.singletonList(address));
|
||||||
ctx.addSubscribtion(address);
|
ctx.addSubscribtion(address);
|
||||||
|
|
||||||
verify(ctx.addresses(), atLeastOnce()).save(address);
|
verify(ctx.addresses(), atLeastOnce()).save(address);
|
||||||
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import static ch.dissem.bitmessage.entity.Plaintext.Type.MSG;
|
import static ch.dissem.bitmessage.entity.Plaintext.Type.MSG;
|
||||||
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class SerializationTest extends TestBase {
|
public class SerializationTest extends TestBase {
|
||||||
@ -78,7 +79,7 @@ public class SerializationTest extends TestBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensurePlaintextIsSerializedAndDeserializedCorrectly() throws Exception {
|
public void ensurePlaintextIsSerializedAndDeserializedCorrectly() throws Exception {
|
||||||
Plaintext p1 = new Plaintext.Builder(MSG)
|
Plaintext expected = new Plaintext.Builder(MSG)
|
||||||
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
||||||
.to(TestUtils.loadContact())
|
.to(TestUtils.loadContact())
|
||||||
.message("Subject", "Message")
|
.message("Subject", "Message")
|
||||||
@ -86,21 +87,21 @@ public class SerializationTest extends TestBase {
|
|||||||
.signature(new byte[0])
|
.signature(new byte[0])
|
||||||
.build();
|
.build();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
p1.write(out);
|
expected.write(out);
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||||
Plaintext p2 = Plaintext.read(MSG, in);
|
Plaintext actual = Plaintext.read(MSG, in);
|
||||||
|
|
||||||
// Received is automatically set on deserialization, so we'll need to set it to 0
|
// Received is automatically set on deserialization, so we'll need to set it to null
|
||||||
Field received = Plaintext.class.getDeclaredField("received");
|
Field received = Plaintext.class.getDeclaredField("received");
|
||||||
received.setAccessible(true);
|
received.setAccessible(true);
|
||||||
received.set(p2, 0L);
|
received.set(actual, null);
|
||||||
|
|
||||||
assertEquals(p1, p2);
|
assertThat(expected, is(actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensurePlaintextWithExtendedEncodingIsSerializedAndDeserializedCorrectly() throws Exception {
|
public void ensurePlaintextWithExtendedEncodingIsSerializedAndDeserializedCorrectly() throws Exception {
|
||||||
Plaintext p1 = new Plaintext.Builder(MSG)
|
Plaintext expected = new Plaintext.Builder(MSG)
|
||||||
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
||||||
.to(TestUtils.loadContact())
|
.to(TestUtils.loadContact())
|
||||||
.message(new Message.Builder()
|
.message(new Message.Builder()
|
||||||
@ -111,42 +112,42 @@ public class SerializationTest extends TestBase {
|
|||||||
.signature(new byte[0])
|
.signature(new byte[0])
|
||||||
.build();
|
.build();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
p1.write(out);
|
expected.write(out);
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||||
Plaintext p2 = Plaintext.read(MSG, in);
|
Plaintext actual = Plaintext.read(MSG, in);
|
||||||
|
|
||||||
// Received is automatically set on deserialization, so we'll need to set it to 0
|
// Received is automatically set on deserialization, so we'll need to set it to null
|
||||||
Field received = Plaintext.class.getDeclaredField("received");
|
Field received = Plaintext.class.getDeclaredField("received");
|
||||||
received.setAccessible(true);
|
received.setAccessible(true);
|
||||||
received.set(p2, 0L);
|
received.set(actual, null);
|
||||||
|
|
||||||
assertEquals(p1, p2);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ensurePlaintextWithAckMessageIsSerializedAndDeserializedCorrectly() throws Exception {
|
public void ensurePlaintextWithAckMessageIsSerializedAndDeserializedCorrectly() throws Exception {
|
||||||
Plaintext p1 = new Plaintext.Builder(MSG)
|
Plaintext expected = new Plaintext.Builder(MSG)
|
||||||
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
.from(TestUtils.loadIdentity("BM-2cSqjfJ8xK6UUn5Rw3RpdGQ9RsDkBhWnS8"))
|
||||||
.to(TestUtils.loadContact())
|
.to(TestUtils.loadContact())
|
||||||
.message("Subject", "Message")
|
.message("Subject", "Message")
|
||||||
.ackData("ackMessage".getBytes())
|
.ackData("ackMessage".getBytes())
|
||||||
.signature(new byte[0])
|
.signature(new byte[0])
|
||||||
.build();
|
.build();
|
||||||
ObjectMessage ackMessage1 = p1.getAckMessage();
|
ObjectMessage ackMessage1 = expected.getAckMessage();
|
||||||
assertNotNull(ackMessage1);
|
assertNotNull(ackMessage1);
|
||||||
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
p1.write(out);
|
expected.write(out);
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||||
Plaintext p2 = Plaintext.read(MSG, in);
|
Plaintext actual = Plaintext.read(MSG, in);
|
||||||
|
|
||||||
// Received is automatically set on deserialization, so we'll need to set it to 0
|
// Received is automatically set on deserialization, so we'll need to set it to null
|
||||||
Field received = Plaintext.class.getDeclaredField("received");
|
Field received = Plaintext.class.getDeclaredField("received");
|
||||||
received.setAccessible(true);
|
received.setAccessible(true);
|
||||||
received.set(p2, 0L);
|
received.set(actual, null);
|
||||||
|
|
||||||
assertEquals(p1, p2);
|
assertEquals(expected, actual);
|
||||||
assertEquals(ackMessage1, p2.getAckMessage());
|
assertEquals(ackMessage1, actual.getAckMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package ch.dissem.bitmessage.networking;
|
package ch.dissem.bitmessage.testutils;
|
||||||
|
|
||||||
import ch.dissem.bitmessage.entity.ObjectMessage;
|
import ch.dissem.bitmessage.entity.ObjectMessage;
|
||||||
import ch.dissem.bitmessage.entity.payload.ObjectType;
|
import ch.dissem.bitmessage.entity.payload.ObjectType;
|
@ -119,7 +119,7 @@ public class ConversationServiceTest {
|
|||||||
.message(content)
|
.message(content)
|
||||||
.status(status);
|
.status(status);
|
||||||
if (status != Plaintext.Status.DRAFT && status != Plaintext.Status.DOING_PROOF_OF_WORK) {
|
if (status != Plaintext.Status.DRAFT && status != Plaintext.Status.DOING_PROOF_OF_WORK) {
|
||||||
builder.received(5 * ++timer - RANDOM.nextInt(10));
|
builder.received(5L * ++timer - RANDOM.nextInt(10));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ uploadArchives {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
|
compile 'org.bouncycastle:bcprov-jdk15on:1.56'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import ch.dissem.bitmessage.entity.valueobject.NetworkAddress;
|
|||||||
import ch.dissem.bitmessage.exception.NodeException;
|
import ch.dissem.bitmessage.exception.NodeException;
|
||||||
import ch.dissem.bitmessage.networking.nio.NioNetworkHandler;
|
import ch.dissem.bitmessage.networking.nio.NioNetworkHandler;
|
||||||
import ch.dissem.bitmessage.ports.*;
|
import ch.dissem.bitmessage.ports.*;
|
||||||
|
import ch.dissem.bitmessage.testutils.TestInventory;
|
||||||
import ch.dissem.bitmessage.utils.Property;
|
import ch.dissem.bitmessage.utils.Property;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -32,6 +32,11 @@ class TestNodeRegistry implements NodeRegistry {
|
|||||||
this.nodes = Arrays.asList(nodes);
|
this.nodes = Arrays.asList(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
// no op
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NetworkAddress> getKnownAddresses(int limit, long... streams) {
|
public List<NetworkAddress> getKnownAddresses(int limit, long... streams) {
|
||||||
return nodes;
|
return nodes;
|
||||||
|
@ -16,7 +16,7 @@ dependencies {
|
|||||||
compile project(':core')
|
compile project(':core')
|
||||||
compile 'org.flywaydb:flyway-core:4.0.3'
|
compile 'org.flywaydb:flyway-core:4.0.3'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'com.h2database:h2:1.4.192'
|
testCompile 'com.h2database:h2:1.4.194'
|
||||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||||
testCompile project(path: ':core', configuration: 'testArtifacts')
|
testCompile project(path: ':core', configuration: 'testArtifacts')
|
||||||
testCompile project(':cryptography-bc')
|
testCompile project(':cryptography-bc')
|
||||||
|
@ -114,13 +114,13 @@ public class JdbcMessageRepository extends AbstractMessageRepository implements
|
|||||||
builder.from(ctx.getAddressRepository().getAddress(rs.getString("sender")));
|
builder.from(ctx.getAddressRepository().getAddress(rs.getString("sender")));
|
||||||
builder.to(ctx.getAddressRepository().getAddress(rs.getString("recipient")));
|
builder.to(ctx.getAddressRepository().getAddress(rs.getString("recipient")));
|
||||||
builder.ackData(rs.getBytes("ack_data"));
|
builder.ackData(rs.getBytes("ack_data"));
|
||||||
builder.sent(rs.getLong("sent"));
|
builder.sent(rs.getObject("sent", Long.class));
|
||||||
builder.received(rs.getLong("received"));
|
builder.received(rs.getObject("received", Long.class));
|
||||||
builder.status(Plaintext.Status.valueOf(rs.getString("status")));
|
builder.status(Plaintext.Status.valueOf(rs.getString("status")));
|
||||||
builder.ttl(rs.getLong("ttl"));
|
builder.ttl(rs.getLong("ttl"));
|
||||||
builder.retries(rs.getInt("retries"));
|
builder.retries(rs.getInt("retries"));
|
||||||
builder.nextTry(rs.getLong("next_try"));
|
builder.nextTry(rs.getObject("next_try", Long.class));
|
||||||
builder.conversation((UUID) rs.getObject("conversation"));
|
builder.conversation(rs.getObject("conversation", UUID.class));
|
||||||
builder.labels(findLabels(connection,
|
builder.labels(findLabels(connection,
|
||||||
"id IN (SELECT label_id FROM Message_Label WHERE message_id=" + id + ") ORDER BY ord"));
|
"id IN (SELECT label_id FROM Message_Label WHERE message_id=" + id + ") ORDER BY ord"));
|
||||||
Plaintext message = builder.build();
|
Plaintext message = builder.build();
|
||||||
@ -232,8 +232,8 @@ public class JdbcMessageRepository extends AbstractMessageRepository implements
|
|||||||
ps.setString(4, message.getTo() == null ? null : message.getTo().getAddress());
|
ps.setString(4, message.getTo() == null ? null : message.getTo().getAddress());
|
||||||
writeBlob(ps, 5, message);
|
writeBlob(ps, 5, message);
|
||||||
ps.setBytes(6, message.getAckData());
|
ps.setBytes(6, message.getAckData());
|
||||||
ps.setLong(7, message.getSent());
|
ps.setObject(7, message.getSent());
|
||||||
ps.setLong(8, message.getReceived());
|
ps.setObject(8, message.getReceived());
|
||||||
ps.setString(9, message.getStatus() == null ? null : message.getStatus().name());
|
ps.setString(9, message.getStatus() == null ? null : message.getStatus().name());
|
||||||
ps.setBytes(10, message.getInitialHash());
|
ps.setBytes(10, message.getInitialHash());
|
||||||
ps.setLong(11, message.getTTL());
|
ps.setLong(11, message.getTTL());
|
||||||
@ -261,8 +261,8 @@ public class JdbcMessageRepository extends AbstractMessageRepository implements
|
|||||||
ps.setString(4, message.getTo() == null ? null : message.getTo().getAddress());
|
ps.setString(4, message.getTo() == null ? null : message.getTo().getAddress());
|
||||||
writeBlob(ps, 5, message);
|
writeBlob(ps, 5, message);
|
||||||
ps.setBytes(6, message.getAckData());
|
ps.setBytes(6, message.getAckData());
|
||||||
ps.setLong(7, message.getSent());
|
ps.setObject(7, message.getSent());
|
||||||
ps.setLong(8, message.getReceived());
|
ps.setObject(8, message.getReceived());
|
||||||
ps.setString(9, message.getStatus() == null ? null : message.getStatus().name());
|
ps.setString(9, message.getStatus() == null ? null : message.getStatus().name());
|
||||||
ps.setBytes(10, message.getInitialHash());
|
ps.setBytes(10, message.getInitialHash());
|
||||||
ps.setLong(11, message.getTTL());
|
ps.setLong(11, message.getTTL());
|
||||||
|
@ -218,6 +218,7 @@ public class JdbcMessageRepositoryTest extends TestBase {
|
|||||||
.from(identity)
|
.from(identity)
|
||||||
.to(contactA)
|
.to(contactA)
|
||||||
.message("Subject", "Message")
|
.message("Subject", "Message")
|
||||||
|
.sent(UnixTime.now())
|
||||||
.status(Plaintext.Status.SENT)
|
.status(Plaintext.Status.SENT)
|
||||||
.ttl(2)
|
.ttl(2)
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user