@Test public void peerTypeExtractionFromConfiguration() { ServerContext context = createMock(ServerContext.class); String peerName = "peer"; String configuration = "java.lang.String,foo"; var conf = new ConfigurationCopy(Map.of(Property.REPLICATION_PEERS + peerName, configuration)); expect(context.getConfiguration()).andReturn(conf); replay(context); ReplicationProcessor proc = new ReplicationProcessor(context); assertEquals(configuration, proc.getPeerType(peerName)); verify(context); }
protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; }
ReplicationProcessor implements Processor { protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; } }
ReplicationProcessor implements Processor { protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; } ReplicationProcessor(ServerContext context); }
ReplicationProcessor implements Processor { protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; } ReplicationProcessor(ServerContext context); @Override ReplicationProcessor newProcessor(); @Override void process(String workID, byte[] data); }
ReplicationProcessor implements Processor { protected String getPeerType(String peerName) { Map<String,String> configuredPeers = context.getConfiguration().getAllPropertiesWithPrefix(Property.REPLICATION_PEERS); String peerType = configuredPeers.get(Property.REPLICATION_PEERS.getKey() + peerName); if (peerType == null) { String msg = "Cannot process replication for unknown peer: " + peerName; log.warn(msg); throw new IllegalArgumentException(msg); } return peerType; } ReplicationProcessor(ServerContext context); @Override ReplicationProcessor newProcessor(); @Override void process(String workID, byte[] data);  }