use of org.kie.workbench.common.stunner.client.widgets.presenters.session.RequestSessionRefreshEvent in project kie-wb-common by kiegroup.
the class ProfileSelectorTest method testBind.
@Test
public void testBind() {
when(selector.getSelectedItem()).thenReturn(profile1);
tested.bind(() -> session);
verify(selector, times(1)).clear();
verify(selector, times(1)).addItem(eq(profile1));
ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class);
verify(selector, times(1)).setValueChangedCommand(commandArgumentCaptor.capture());
Command command = commandArgumentCaptor.getValue();
command.execute();
verify(metadata, times(1)).setProfileId(eq(PROFILE_ID));
ArgumentCaptor<RequestSessionRefreshEvent> eventArgumentCaptor = ArgumentCaptor.forClass(RequestSessionRefreshEvent.class);
verify(requestSessionRefreshEvent, times(1)).fire(eventArgumentCaptor.capture());
RequestSessionRefreshEvent event = eventArgumentCaptor.getValue();
assertEquals(SESSION_UUID, event.getSessionUUID());
}
use of org.kie.workbench.common.stunner.client.widgets.presenters.session.RequestSessionRefreshEvent in project kie-wb-common by kiegroup.
the class ProfileSelector method bind.
public ProfileSelector bind(final Supplier<AbstractSession> sessionSupplier) {
final AbstractSession session = sessionSupplier.get();
final Metadata metadata = session.getCanvasHandler().getDiagram().getMetadata();
final String definitionSetId = metadata.getDefinitionSetId();
final String profileId = metadata.getProfileId();
useDefinitionSet(definitionSetId);
useProfile(definitionSetId, profileId);
selector.setValueChangedCommand(() -> {
final Profile item = selector.getSelectedItem();
metadata.setProfileId(item.getProfileId());
requestSessionRefreshEvent.fire(new RequestSessionRefreshEvent(session.getSessionUUID()));
});
return this;
}
Aggregations