@Test public void testNetworkConfig() { NetworkConfig networkConfig = config.getNetworkConfig(); assertNotNull(networkConfig); assertEquals(5700, networkConfig.getPort()); assertFalse(networkConfig.isPortAutoIncrement()); final Collection<String> allowedPorts = networkConfig.getOutboundPortDefinitions(); assertEquals(2, allowedPorts.size()); Iterator portIter = allowedPorts.iterator(); assertEquals("35000-35100", portIter.next()); assertEquals("36000,36100", portIter.next()); assertFalse(networkConfig.getJoin().getMulticastConfig().isEnabled()); assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeoutSeconds(), 8); assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeToLive(), 16); assertFalse(networkConfig.getInterfaces().isEnabled()); assertEquals(1, networkConfig.getInterfaces().getInterfaces().size()); assertEquals("10.10.1.*", networkConfig.getInterfaces().getInterfaces().iterator().next()); TcpIpConfig tcp = networkConfig.getJoin().getTcpIpConfig(); assertNotNull(tcp); assertTrue(tcp.isEnabled()); assertTrue(networkConfig.getSymmetricEncryptionConfig().isEnabled()); final List<String> members = tcp.getMembers(); assertEquals(members.toString(), 2, members.size()); assertEquals("127.0.0.1:5700", members.get(0)); assertEquals("127.0.0.1:5701", members.get(1)); assertEquals("127.0.0.1:5700", tcp.getRequiredMember()); AwsConfig aws = networkConfig.getJoin().getAwsConfig(); assertFalse(aws.isEnabled()); assertEquals("sample-access-key", aws.getAccessKey()); assertEquals("sample-secret-key", aws.getSecretKey()); assertEquals("sample-region", aws.getRegion()); assertEquals("sample-group", aws.getSecurityGroupName()); assertEquals("sample-tag-key", aws.getTagKey()); assertEquals("sample-tag-value", aws.getTagValue()); }
List<Edge> detectDeadlock() { Collection<Map<String, MapLockState>> collection = (Collection<Map<String, MapLockState>>) callOnAllMembers(new LockInformationCallable()); List<Vertex> graph = new ArrayList<Vertex>(); for (Map<String, MapLockState> mapLockStateMap : collection) { for (MapLockState map : mapLockStateMap.values()) { for (Object key : map.getLockOwners().keySet()) { Vertex owner = new Vertex(map.getLockOwners().get(key)); Vertex requester = new Vertex(map.getLockRequested().get(key)); int index = graph.indexOf(owner); if (index >= 0) { owner = graph.get(index); } else { graph.add(owner); } index = graph.indexOf(requester); if (index >= 0) { requester = graph.get(index); } else { graph.add(requester); } Edge edge = new Edge(); edge.from = requester; edge.to = owner; edge.key = key; edge.mapName = map.getMapName(); edge.globalLock = map.isGlobalLock(); owner.addIncoming(edge); requester.addOutgoing(edge); } } } List<Edge> list = new ArrayList<Edge>(); if (graph != null && graph.size() > 0) { try { graph.get(0).visit(list); } catch (RuntimeException e) { } } return list; }