public Container( final String containerSpecId, final String containerName, final ServerInstanceKey serverInstanceKey, final Collection<Message> messages, final ReleaseId resolvedReleasedId, final String url ) { super( containerSpecId, containerName, serverInstanceKey ); this.serverInstanceId = serverInstanceKey.getServerInstanceId(); this.messages.addAll( messages ); this.resolvedReleasedId = resolvedReleasedId; }
public Container( final String containerSpecId, final String containerName, final ServerInstanceKey serverInstanceKey, final Collection<Message> messages, final ReleaseId resolvedReleasedId, final String url ) { super( containerSpecId, containerName, serverInstanceKey ); this.serverInstanceId = serverInstanceKey.getServerInstanceId(); this.messages.addAll( messages ); this.resolvedReleasedId = resolvedReleasedId; }
public void deleteServerInstance(String serverInstanceId) { if (serverInstances == null) { return; } Iterator<ServerInstanceKey> iterator = serverInstances.iterator(); while(iterator.hasNext()) { ServerInstanceKey serverInstanceKey = iterator.next(); if (serverInstanceId.equals(serverInstanceKey.getServerInstanceId())) { iterator.remove(); } } }
public void deleteServerInstance(String serverInstanceId) { if (serverInstances == null) { return; } Iterator<ServerInstanceKey> iterator = serverInstances.iterator(); while(iterator.hasNext()) { ServerInstanceKey serverInstanceKey = iterator.next(); if (serverInstanceId.equals(serverInstanceKey.getServerInstanceId())) { iterator.remove(); } } }
public boolean hasServerInstanceId(String serverInstanceId) { for (ServerInstanceKey instance : getServerInstanceKeys()) { if (instance.getServerInstanceId().equals(serverInstanceId)) { return true; } } return false; }
public boolean hasServerInstanceId(String serverInstanceId) { for (ServerInstanceKey instance : getServerInstanceKeys()) { if (instance.getServerInstanceId().equals(serverInstanceId)) { return true; } } return false; }
public ServerInstanceKey getServerInstance(String serverInstanceId) { for (ServerInstanceKey instance : getServerInstanceKeys()) { if (instance.getServerInstanceId().equals(serverInstanceId)) { return instance; } } return null; }
protected void indexServerInstances(ServerTemplate serverTemplate) { for (ServerInstanceKey serverInstanceKey : serverTemplate.getServerInstanceKeys()) { serverInstancesById.put(serverInstanceKey.getServerInstanceId(), serverInstanceKey); } }
protected void indexServerInstances(ServerTemplate serverTemplate) { serverTemplate.getServerInstanceKeys().forEach(serverInstanceKey -> serverInstancesById.put(serverInstanceKey.getServerInstanceId(), serverInstanceKey)); }
private void index( final Container container, final ContainerCardPresenter cardPresenter ) { if ( !index.containsKey( container.getServerInstanceKey().getServerInstanceId() ) ) { index.put( container.getServerInstanceKey().getServerInstanceId(), new HashMap<String, ContainerCardPresenter>() ); } index.get( container.getServerInstanceKey().getServerInstanceId() ).put( container.getContainerSpecId(), cardPresenter ); }
private void addServerInstance( final ServerInstanceKey serverInstanceKey ) { serverInstances.add( serverInstanceKey.getServerInstanceId() ); view.addServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId(), serverInstanceKey.getServerName(), new Command() { @Override public void execute() { serverInstanceSelectedEvent.fire( new ServerInstanceSelected( serverInstanceKey ) ); } } ); }
@Override public ContainerList getContainers(ServerInstanceKey serverInstanceKey) { return makeGetRequestAndCreateCustomResponse(controllerBaseUrl + RUNTIME_URI_PART + serverInstanceKey.getServerTemplateId() + INSTANCES_URI_PART + serverInstanceKey.getServerInstanceId() + CONTAINERS_URI_PART, ContainerList.class); }
@Override public ContainerList getContainers(ServerInstanceKey serverInstanceKey) { return getServerInstanceContainers(serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId()); }
public void onInstanceUpdate( @Observes final ServerInstanceUpdated serverInstanceUpdated ) { if ( serverInstanceUpdated != null && serverInstanceUpdated.getServerInstance() != null ) { final ServerInstanceKey updatedServerInstanceKey = toKey( serverInstanceUpdated.getServerInstance() ); if ( serverInstanceKey != null && serverInstanceKey.getServerInstanceId().equals( updatedServerInstanceKey.getServerInstanceId() ) ) { serverInstanceKey = updatedServerInstanceKey; loadContent( serverInstanceUpdated.getServerInstance().getContainers() ); } } else { logger.warn( "Illegal event argument." ); } }
public void onServerInstanceSelect( @Observes final ServerInstanceSelected serverInstanceSelected ) { if ( serverInstanceSelected != null && serverInstanceSelected.getServerInstanceKey() != null && serverInstanceSelected.getServerInstanceKey().getServerTemplateId() != null && serverInstanceSelected.getServerInstanceKey().getServerInstanceId() != null ) { view.selectServerInstance( serverInstanceSelected.getServerInstanceKey().getServerTemplateId(), serverInstanceSelected.getServerInstanceKey().getServerInstanceId() ); } else { logger.warn( "Illegal event argument." ); } }
public void load( final ServerInstanceKey serverInstanceKey ) { runtimeManagementService.call( new RemoteCallback<Collection<Container>>() { @Override public void callback( final Collection<Container> containers ) { loadContent( containers ); } } ).getContainersByServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId() ); }
protected void notifyOnDisconnect(ServerInstanceKey serverInstanceKey, ServerTemplate serverTemplate) { notificationService.notify(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId())); notificationService.notify(new ServerTemplateUpdated(serverTemplate)); notificationService.notify(new ServerInstanceDisconnected(serverInstanceKey.getServerInstanceId())); }
@Test public void testOnDeleteWithoutCurrentServer() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); presenter.onDelete( new ServerInstanceDeleted( serverInstanceKey.getServerInstanceId() ) ); verify( specManagementService, never() ).listServerTemplateKeys(); }
@Test public void testSelectAndRefreshEmptyContainers() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "templateId", "serverName", "serverInstanceId", "url" ); when( runtimeManagementService.getContainersByServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId() ) ).thenReturn( Collections.<Container>emptyList() ); presenter.onSelect( new ServerInstanceSelected( serverInstanceKey ) ); verify( view ).clear(); verify( view ).setServerName( serverInstanceKey.getServerName() ); verify( view ).setServerURL( serverInstanceKey.getUrl() ); verify( view ).setEmptyView( remoteEmptyPresenter.getView() ); }
@Test public void testOnServerInstanceSelect() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); presenter.onServerInstanceSelect( new ServerInstanceSelected( serverInstanceKey ) ); verify( view ).selectServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId() ); }