use of io.spine.test.commandservice.customer.Customer in project core-java by SpineEventEngine.
the class StandShould method getDuplicateCostumerStreamObserver.
private static MemoizeQueryResponseObserver getDuplicateCostumerStreamObserver() {
return new MemoizeQueryResponseObserver() {
@Override
public void onNext(QueryResponse value) {
super.onNext(value);
final List<Any> messages = value.getMessagesList();
assertFalse(messages.isEmpty());
final Customer customer = unpack(messages.get(0));
final Customer sampleCustomer = getSampleCustomer();
assertEquals(sampleCustomer.getName(), customer.getName());
assertEquals(sampleCustomer.getNicknamesList(), customer.getNicknamesList());
assertTrue(customer.hasId());
}
};
}
use of io.spine.test.commandservice.customer.Customer in project core-java by SpineEventEngine.
the class StandShould method trigger_subscription_callback_upon_update_of_aggregate.
@Test
public void trigger_subscription_callback_upon_update_of_aggregate() {
final Stand stand = prepareStandWithAggregateRepo(mock(StandStorage.class));
final Topic allCustomers = requestFactory.topic().allOf(Customer.class);
final MemoizeEntityUpdateCallback memoizeCallback = new MemoizeEntityUpdateCallback();
subscribeAndActivate(stand, allCustomers, memoizeCallback);
assertNull(memoizeCallback.newEntityState);
final Map.Entry<CustomerId, Customer> sampleData = fillSampleCustomers(1).entrySet().iterator().next();
final CustomerId customerId = sampleData.getKey();
final Customer customer = sampleData.getValue();
final Version stateVersion = GivenVersion.withNumber(1);
stand.update(asEnvelope(customerId, customer, stateVersion));
final Any packedState = AnyPacker.pack(customer);
assertEquals(packedState, memoizeCallback.newEntityState);
}
Aggregations