@Test public void testProduce() throws Exception { DefaultCMessagingConfigService s = createServiceWithXml("consume_both.xml"); assertFalse(s.isHermesProducerEnabled("ex1", "pid0", "2.2.2.1")); assertFalse(s.isHermesProducerEnabled("ex1", "pid0", "2.2.2.3")); assertFalse(s.isHermesProducerEnabled("ex1", "pid3", "2.2.2.1")); assertFalse(s.isHermesProducerEnabled("ex2", "pid0", "2.2.2.1")); assertFalse(s.isHermesProducerEnabled("ex10", "pid0", "2.2.2.1")); assertTrue(s.isHermesProducerEnabled("ex1", "pid1", "2.2.2.1")); assertTrue(s.isHermesProducerEnabled("ex1", "pid1", "2.2.2.2")); assertFalse(s.isHermesProducerEnabled("ex1", "pid1", "2.2.2.3")); assertTrue(s.isHermesProducerEnabled("ex1", "pid2", "2.2.2.1")); assertTrue(s.isHermesProducerEnabled("ex1", "pid2", "2.2.2.3")); assertTrue(s.isHermesProducerEnabled("ex3", "pid10", "2.2.2.3")); }
@Override public boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip) { Exchange exchange = findExchange(exchangeName); if (exchange == null || exchange.getProduce() == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(exchange.getProduce().getState())) { ProduceGroup group = exchange.getProduce().findProduceGroup(identifier); if (group == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(group.getState())) { return group.findNode(ip) != null; } else { return nonGrayProduceStateToBoolean(group.getState()); } } } else { return nonGrayProduceStateToBoolean(exchange.getProduce().getState()); } } }
DefaultCMessagingConfigService implements CMessagingConfigService, Initializable { @Override public boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip) { Exchange exchange = findExchange(exchangeName); if (exchange == null || exchange.getProduce() == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(exchange.getProduce().getState())) { ProduceGroup group = exchange.getProduce().findProduceGroup(identifier); if (group == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(group.getState())) { return group.findNode(ip) != null; } else { return nonGrayProduceStateToBoolean(group.getState()); } } } else { return nonGrayProduceStateToBoolean(exchange.getProduce().getState()); } } } }
DefaultCMessagingConfigService implements CMessagingConfigService, Initializable { @Override public boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip) { Exchange exchange = findExchange(exchangeName); if (exchange == null || exchange.getProduce() == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(exchange.getProduce().getState())) { ProduceGroup group = exchange.getProduce().findProduceGroup(identifier); if (group == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(group.getState())) { return group.findNode(ip) != null; } else { return nonGrayProduceStateToBoolean(group.getState()); } } } else { return nonGrayProduceStateToBoolean(exchange.getProduce().getState()); } } }  }
DefaultCMessagingConfigService implements CMessagingConfigService, Initializable { @Override public boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip) { Exchange exchange = findExchange(exchangeName); if (exchange == null || exchange.getProduce() == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(exchange.getProduce().getState())) { ProduceGroup group = exchange.getProduce().findProduceGroup(identifier); if (group == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(group.getState())) { return group.findNode(ip) != null; } else { return nonGrayProduceStateToBoolean(group.getState()); } } } else { return nonGrayProduceStateToBoolean(exchange.getProduce().getState()); } } }  @Override String getTopic(String exchangeName); @Override String getGroupId(String exchangeName, String idAndQueueName); @Override boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip); @Override int getConsumerType(String exchangeName, String identifier, String ip); @Override void initialize(); }
DefaultCMessagingConfigService implements CMessagingConfigService, Initializable { @Override public boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip) { Exchange exchange = findExchange(exchangeName); if (exchange == null || exchange.getProduce() == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(exchange.getProduce().getState())) { ProduceGroup group = exchange.getProduce().findProduceGroup(identifier); if (group == null) { return false; } else { if (Produce.GRAY.equalsIgnoreCase(group.getState())) { return group.findNode(ip) != null; } else { return nonGrayProduceStateToBoolean(group.getState()); } } } else { return nonGrayProduceStateToBoolean(exchange.getProduce().getState()); } } }  @Override String getTopic(String exchangeName); @Override String getGroupId(String exchangeName, String idAndQueueName); @Override boolean isHermesProducerEnabled(String exchangeName, String identifier, String ip); @Override int getConsumerType(String exchangeName, String identifier, String ip); @Override void initialize();  }