use of com.github.dedis.popstellar.model.network.method.message.data.lao.CreateLao in project popstellar by dedis.
the class RollCallHandlerTest method setup.
@Before
public void setup() throws GeneralSecurityException, IOException, KeyException {
lenient().when(keyManager.getMainKeyPair()).thenReturn(SENDER_KEY);
lenient().when(keyManager.getMainPublicKey()).thenReturn(SENDER);
lenient().when(keyManager.getValidPoPToken(any(), any())).thenReturn(POP_TOKEN);
when(messageSender.subscribe(any())).then(args -> Completable.complete());
laoRepository = new LAORepository();
messageHandler = new MessageHandler(DataRegistryModule.provideDataRegistry(), keyManager);
// Create one LAO
Lao lao = new Lao(CREATE_LAO.getName(), CREATE_LAO.getOrganizer(), CREATE_LAO.getCreation());
lao.setLastModified(lao.getCreation());
// Create one Roll Call and add it to the LAO
rollCall = new RollCall(lao.getId(), Instant.now().getEpochSecond(), "roll call 1");
rollCall.setLocation("EPFL");
lao.setRollCalls(new HashMap<String, RollCall>() {
{
put(rollCall.getId(), rollCall);
}
});
// Add the LAO to the LAORepository
laoRepository.getLaoById().put(lao.getId(), new LAOState(lao));
laoRepository.setAllLaoSubject();
// Add the CreateLao message to the LAORepository
MessageGeneral createLaoMessage = new MessageGeneral(SENDER_KEY, CREATE_LAO, GSON);
laoRepository.getMessageById().put(createLaoMessage.getMessageId(), createLaoMessage);
}
Aggregations