public void select(final String id) { serverTemplateSelectedEvent.fire(new ServerTemplateSelected(new ServerTemplateKey(id, ""))); }
@Test public void testSetupList() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final ServerTemplateKey serverTemplateKey2 = new ServerTemplateKey( "ServerTemplateKeyId2", "ServerTemplateKeyName2" ); presenter.setup( serverTemplateKey, Collections.singletonList( serverTemplateKey2 ) ); verify( view ).clean(); verify( view ).addTemplate( serverTemplateKey.getId(), serverTemplateKey.getName() ); verify( view ).addTemplate( serverTemplateKey2.getId(), serverTemplateKey2.getName() ); }
@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof ServerTemplateSelected ) ) { return false; } final ServerTemplateSelected that = (ServerTemplateSelected) o; if ( serverTemplateKey != null ? !serverTemplateKey.equals( that.serverTemplateKey ) : that.serverTemplateKey != null ) { return false; } return containerId != null ? containerId.equals( that.containerId ) : that.containerId == null; }
public boolean hasMatchingId(ServerTemplateKey serverTemplateKey) { return getId().equals(serverTemplateKey.getId()); }
@Test public void testOnSelect() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); presenter.onSelect( new ServerTemplateSelected( serverTemplateKey ) ); verify( view ).select( serverTemplateKey.getId() ); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (capabilities != null ? capabilities.hashCode() : 0); return result; } }
public boolean hasMatchingId(ServerTemplateKey serverTemplateKey) { return getId().equals(serverTemplateKey.getId()); }
@Test public void testCreateServerTemplate() { ServerTemplate serverTemplate = new ServerTemplate(); serverTemplate.setName("test server"); serverTemplate.setId(UUID.randomUUID().toString()); specManagementService.saveServerTemplate(serverTemplate); ServerTemplateKeyList existing = specManagementService.listServerTemplateKeys(); assertNotNull(existing); assertEquals(1, existing.getServerTemplates().length); org.kie.server.controller.api.model.spec.ServerTemplateKey saved = existing.getServerTemplates()[0]; assertEquals(serverTemplate.getName(), saved.getName()); assertEquals(serverTemplate.getId(), saved.getId()); }
@Test public void testOnSelectedServerTemplate() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); when( specManagementService.getServerTemplate( serverTemplateKey.getId() ) ).thenReturn( serverTemplate ); final ServerTemplatePresenter.View serverView = mock( ServerTemplatePresenter.View.class ); when( serverTemplatePresenter.getView() ).thenReturn( serverView ); final ServerContainerEmptyPresenter.View serverEmptyView = mock( ServerContainerEmptyPresenter.View.class ); when( serverContainerEmptyPresenter.getView() ).thenReturn( serverEmptyView ); presenter.onSelected( new ServerTemplateSelected( serverTemplateKey ) ); verify( view ).setServerTemplate( serverView ); verify( specManagementService ).getServerTemplate( serverTemplateKey.getId() ); verify( serverContainerEmptyPresenter ).setTemplate( serverTemplate ); verify( view ).setContent( serverEmptyView ); verify( serverTemplatePresenter ).setup( serverTemplate, null ); }
@Override public int hashCode() { int result = serverTemplateKey != null ? serverTemplateKey.hashCode() : 0; result = 31 * result + ( containerId != null ? containerId.hashCode() : 0 ); return result; } }
private ContainerSpecKey buildContainerSpecKey( final Container container ) { return new ContainerSpecKey( container.getContainerSpecId(), container.getContainerName(), new ServerTemplateKey( container.getServerInstanceKey().getServerTemplateId(), "" ) ); } }
containerSpec.setServerTemplateKey(new ServerTemplateKey(containerSpec.getServerTemplateKey().getId(), containerSpec.getServerTemplateKey().getName()));
public void onSelect(@Observes final ServerTemplateSelected serverTemplateSelected) { if (serverTemplateSelected != null && serverTemplateSelected.getServerTemplateKey() != null && serverTemplateSelected.getServerTemplateKey().getId() != null) { view.select(serverTemplateSelected.getServerTemplateKey().getId()); } else { logger.warn("Illegal event argument."); } }
@Test public void testCreateAndDeleteServerTemplate() { ServerTemplate serverTemplate = new ServerTemplate(); serverTemplate.setName("test server"); serverTemplate.setId(UUID.randomUUID().toString()); specManagementService.saveServerTemplate(serverTemplate); ServerTemplateKeyList existing = specManagementService.listServerTemplateKeys(); assertNotNull(existing); assertEquals(1, existing.getServerTemplates().length); org.kie.server.controller.api.model.spec.ServerTemplateKey saved = existing.getServerTemplates()[0]; assertEquals(serverTemplate.getName(), saved.getName()); assertEquals(serverTemplate.getId(), saved.getId()); specManagementService.deleteServerTemplate(serverTemplate.getId()); existing = specManagementService.listServerTemplateKeys(); assertNotNull(existing); assertEquals(0, existing.getServerTemplates().length); }
@Test public void testOnContainerSelect() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final ContainerSpecKey containerSpecKey = new ContainerSpecKey( "containerId", "containerName", serverTemplateKey ); presenter.onContainerSelect( new ContainerSpecSelected( containerSpecKey ) ); verify( view ).selectContainer( serverTemplateKey.getId(), containerSpecKey.getId() ); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ServerTemplate)) { return false; } if (!super.equals(o)) { return false; } ServerTemplate that = (ServerTemplate) o; if (capabilities != null ? !capabilities.equals(that.capabilities) : that.capabilities != null) { return false; } return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (capabilities != null ? capabilities.hashCode() : 0); return result; } }
@Override public ServerTemplate store(ServerTemplate serverTemplate) { synchronized (store) { storeKeys.put(serverTemplate.getId(), new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName())); return store.put(serverTemplate.getId(), serverTemplate); } }
@Test public void testSetup() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); presenter.setup( serverTemplateKey, Collections.singletonList( serverTemplateKey ) ); verify( view ).clean(); verify( view ).addTemplate( serverTemplateKey.getId(), serverTemplateKey.getName() ); }