@Test public void testEventOnServerRemovedAndGroupRefresh() { instanceSet0.remove(0); when(agentCache.getAgentInstances(instanceGroups.get(0).getId())).thenReturn(new HashSet<>(instanceSet0)); agentCacheEventSubject.onNext(new CacheUpdateEvent(CacheUpdateType.InstanceGroup, instanceGroups.get(0).getId())); AgentEvent event = eventSubscriber.takeNext(); assertThat(event).isInstanceOf(AgentInstanceRemovedEvent.class); }
@Override public List<AgentInstance> getAgentInstances(String instanceGroupId) { return new ArrayList<>(agentCache.getAgentInstances(instanceGroupId)); }
DefaultAgentManagementService implements AgentManagementService { @Override public List<AgentInstance> getAgentInstances(String instanceGroupId) { return new ArrayList<>(agentCache.getAgentInstances(instanceGroupId)); } }
DefaultAgentManagementService implements AgentManagementService { @Override public List<AgentInstance> getAgentInstances(String instanceGroupId) { return new ArrayList<>(agentCache.getAgentInstances(instanceGroupId)); } @Inject  DefaultAgentManagementService(AgentManagementConfiguration configuration,
                                         @Named(KUBE_SCHEDULER_INSTANCE_GROUP_PREDICATE) Predicate<AgentInstanceGroup> kubeSchedulerInstanceGroupPredicate,
                                         InstanceCloudConnector instanceCloudConnector,
                                         AgentCache AgentCache,
                                         ServerInfoResolver serverInfoResolver,
                                         TitusRuntime titusRuntime); }
DefaultAgentManagementService implements AgentManagementService { @Override public List<AgentInstance> getAgentInstances(String instanceGroupId) { return new ArrayList<>(agentCache.getAgentInstances(instanceGroupId)); } @Inject  DefaultAgentManagementService(AgentManagementConfiguration configuration,
                                         @Named(KUBE_SCHEDULER_INSTANCE_GROUP_PREDICATE) Predicate<AgentInstanceGroup> kubeSchedulerInstanceGroupPredicate,
                                         InstanceCloudConnector instanceCloudConnector,
                                         AgentCache AgentCache,
                                         ServerInfoResolver serverInfoResolver,
                                         TitusRuntime titusRuntime); @Activator void enterActiveMode(); @PreDestroy void shutdown(); @Override boolean isOwnedByFenzo(AgentInstanceGroup instanceGroup); @Override boolean isOwnedByFenzo(AgentInstance instance); @Override List<AgentInstanceGroup> getInstanceGroups(); @Override AgentInstanceGroup getInstanceGroup(String instanceGroupId); @Override Optional<AgentInstanceGroup> findInstanceGroup(String instanceGroupId); @Override AgentInstance getAgentInstance(String instanceId); @Override Optional<AgentInstance> findAgentInstance(String instanceId); @Override List<AgentInstance> getAgentInstances(String instanceGroupId); @Override List<Pair<AgentInstanceGroup, List<AgentInstance>>> findAgentInstances(Predicate<Pair<AgentInstanceGroup, AgentInstance>> filter); @Override ResourceDimension getResourceLimits(String instanceType); @Override Optional<ResourceDimension> findResourceLimits(String instanceType); @Override Completable updateInstanceGroupTier(String instanceGroupId, Tier tier); @Override Completable updateInstanceGroupLifecycle(String instanceGroupId, InstanceGroupLifecycleStatus instanceGroupLifecycleStatus); @Override Completable updateInstanceGroupAttributes(String instanceGroupId, Map<String, String> attributes); @Override Completable deleteInstanceGroupAttributes(String instanceGroupId, Set<String> keys); @Override Completable updateAgentInstanceAttributes(String instanceId, Map<String, String> attributes); @Override Completable deleteAgentInstanceAttributes(String instanceId, Set<String> keys); @Override Completable updateCapacity(String instanceGroupId, Optional<Integer> min, Optional<Integer> desired); @Override Completable scaleUp(String instanceGroupId, int scaleUpCount); @Override Observable<List<Either<Boolean, Throwable>>> terminateAgents(String instanceGroupId, List<String> instanceIds, boolean shrink); @Override Observable<AgentEvent> events(boolean includeSnapshot); }
DefaultAgentManagementService implements AgentManagementService { @Override public List<AgentInstance> getAgentInstances(String instanceGroupId) { return new ArrayList<>(agentCache.getAgentInstances(instanceGroupId)); } @Inject  DefaultAgentManagementService(AgentManagementConfiguration configuration,
                                         @Named(KUBE_SCHEDULER_INSTANCE_GROUP_PREDICATE) Predicate<AgentInstanceGroup> kubeSchedulerInstanceGroupPredicate,
                                         InstanceCloudConnector instanceCloudConnector,
                                         AgentCache AgentCache,
                                         ServerInfoResolver serverInfoResolver,
                                         TitusRuntime titusRuntime); @Activator void enterActiveMode(); @PreDestroy void shutdown(); @Override boolean isOwnedByFenzo(AgentInstanceGroup instanceGroup); @Override boolean isOwnedByFenzo(AgentInstance instance); @Override List<AgentInstanceGroup> getInstanceGroups(); @Override AgentInstanceGroup getInstanceGroup(String instanceGroupId); @Override Optional<AgentInstanceGroup> findInstanceGroup(String instanceGroupId); @Override AgentInstance getAgentInstance(String instanceId); @Override Optional<AgentInstance> findAgentInstance(String instanceId); @Override List<AgentInstance> getAgentInstances(String instanceGroupId); @Override List<Pair<AgentInstanceGroup, List<AgentInstance>>> findAgentInstances(Predicate<Pair<AgentInstanceGroup, AgentInstance>> filter); @Override ResourceDimension getResourceLimits(String instanceType); @Override Optional<ResourceDimension> findResourceLimits(String instanceType); @Override Completable updateInstanceGroupTier(String instanceGroupId, Tier tier); @Override Completable updateInstanceGroupLifecycle(String instanceGroupId, InstanceGroupLifecycleStatus instanceGroupLifecycleStatus); @Override Completable updateInstanceGroupAttributes(String instanceGroupId, Map<String, String> attributes); @Override Completable deleteInstanceGroupAttributes(String instanceGroupId, Set<String> keys); @Override Completable updateAgentInstanceAttributes(String instanceId, Map<String, String> attributes); @Override Completable deleteAgentInstanceAttributes(String instanceId, Set<String> keys); @Override Completable updateCapacity(String instanceGroupId, Optional<Integer> min, Optional<Integer> desired); @Override Completable scaleUp(String instanceGroupId, int scaleUpCount); @Override Observable<List<Either<Boolean, Throwable>>> terminateAgents(String instanceGroupId, List<String> instanceIds, boolean shrink); @Override Observable<AgentEvent> events(boolean includeSnapshot); static final String KUBE_SCHEDULER_INSTANCE_GROUP_PREDICATE; }