@Test public void testAddSessionAttributes() throws Exception { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("foo", "bar"); Cluster cluster = createMock(Cluster.class); ClustersImpl clusters = createMockBuilder(ClustersImpl.class).addMockedMethod("findCluster", String.class).createMock(); expect(clusters.findCluster("c1")).andReturn(cluster); cluster.addSessionAttributes(attributes); replay(clusters, cluster); clusters.addSessionAttributes("c1", attributes); verify(clusters, cluster); }
@Override public void addSessionAttributes(String name, Map<String, Object> attributes) { Cluster cluster = findCluster(name); if (cluster != null) { cluster.addSessionAttributes(attributes); } }
ClustersImpl implements Clusters { @Override public void addSessionAttributes(String name, Map<String, Object> attributes) { Cluster cluster = findCluster(name); if (cluster != null) { cluster.addSessionAttributes(attributes); } } }
ClustersImpl implements Clusters { @Override public void addSessionAttributes(String name, Map<String, Object> attributes) { Cluster cluster = findCluster(name); if (cluster != null) { cluster.addSessionAttributes(attributes); } } @Inject  ClustersImpl(ClusterDAO clusterDAO, ClusterFactory clusterFactory, HostDAO hostDAO,
      HostFactory hostFactory); }
ClustersImpl implements Clusters { @Override public void addSessionAttributes(String name, Map<String, Object> attributes) { Cluster cluster = findCluster(name); if (cluster != null) { cluster.addSessionAttributes(attributes); } } @Inject  ClustersImpl(ClusterDAO clusterDAO, ClusterFactory clusterFactory, HostDAO hostDAO,
      HostFactory hostFactory); @Override void addCluster(String clusterName, StackId stackId); @Override void addCluster(String clusterName, StackId stackId, SecurityType securityType); @Override Cluster getCluster(String clusterName); @Override Cluster getCluster(Long clusterId); @Override Cluster getClusterById(long id); @Override void setCurrentStackVersion(String clusterName, StackId stackId); @Override List<Host> getHosts(); @Override Set<Cluster> getClustersForHost(String hostname); @Override Host getHost(String hostname); @Override boolean hostExists(String hostname); @Override boolean isHostMappedToCluster(String clusterName, String hostName); @Override Host getHostById(Long hostId); @Override void updateHostMappings(Host host); @Override void addHost(String hostname); @Override void updateHostWithClusterAndAttributes(
      Map<String, Set<String>> hostClusters,
      Map<String, Map<String, String>> hostAttributes); @Override void mapAndPublishHostsToCluster(Set<String> hostnames, String clusterName); @Override void mapHostToCluster(String hostname, String clusterName); @Override Map<String, Cluster> getClusters(); @Override void updateClusterName(String oldName, String newName); @Override void debugDump(StringBuilder sb); @Override Map<String, Host> getHostsForCluster(String clusterName); @Override Map<Long, Host> getHostIdsForCluster(String clusterName); @Override void deleteCluster(String clusterName); @Override void unmapHostFromCluster(String hostname, String clusterName); @Override void deleteHost(String hostname); @Override void publishHostsDeletion(Set<Cluster> clusters, Set<String> hostNames); @Override boolean checkPermission(String clusterName, boolean readOnly); @Override void addSessionAttributes(String name, Map<String, Object> attributes); @Override Map<String, Object> getSessionAttributes(String name); @Override int getClusterSize(String clusterName); @Override void invalidate(Cluster cluster); }
ClustersImpl implements Clusters { @Override public void addSessionAttributes(String name, Map<String, Object> attributes) { Cluster cluster = findCluster(name); if (cluster != null) { cluster.addSessionAttributes(attributes); } } @Inject  ClustersImpl(ClusterDAO clusterDAO, ClusterFactory clusterFactory, HostDAO hostDAO,
      HostFactory hostFactory); @Override void addCluster(String clusterName, StackId stackId); @Override void addCluster(String clusterName, StackId stackId, SecurityType securityType); @Override Cluster getCluster(String clusterName); @Override Cluster getCluster(Long clusterId); @Override Cluster getClusterById(long id); @Override void setCurrentStackVersion(String clusterName, StackId stackId); @Override List<Host> getHosts(); @Override Set<Cluster> getClustersForHost(String hostname); @Override Host getHost(String hostname); @Override boolean hostExists(String hostname); @Override boolean isHostMappedToCluster(String clusterName, String hostName); @Override Host getHostById(Long hostId); @Override void updateHostMappings(Host host); @Override void addHost(String hostname); @Override void updateHostWithClusterAndAttributes(
      Map<String, Set<String>> hostClusters,
      Map<String, Map<String, String>> hostAttributes); @Override void mapAndPublishHostsToCluster(Set<String> hostnames, String clusterName); @Override void mapHostToCluster(String hostname, String clusterName); @Override Map<String, Cluster> getClusters(); @Override void updateClusterName(String oldName, String newName); @Override void debugDump(StringBuilder sb); @Override Map<String, Host> getHostsForCluster(String clusterName); @Override Map<Long, Host> getHostIdsForCluster(String clusterName); @Override void deleteCluster(String clusterName); @Override void unmapHostFromCluster(String hostname, String clusterName); @Override void deleteHost(String hostname); @Override void publishHostsDeletion(Set<Cluster> clusters, Set<String> hostNames); @Override boolean checkPermission(String clusterName, boolean readOnly); @Override void addSessionAttributes(String name, Map<String, Object> attributes); @Override Map<String, Object> getSessionAttributes(String name); @Override int getClusterSize(String clusterName); @Override void invalidate(Cluster cluster);  }