@Override public void register(ServerData[] data) { try { final String hostname = Optional.ofNullable(customHostname) .orElse(InetAddress.getLocalHost() .getHostName()); application = new Application( Stream.of(data) .map(next -> new RegisterEntry( next.getPort(), hostname, next.getModule().getContext(), next.getModule().getContext(), null, targetEndpoint, externalPort(next))) .collect(Collectors.toList())); logger.info("Registered application {} ", application); } catch (UnknownHostException e) { throw ExceptionSoftener.throwSoftenedException(e); } }
@Before public void setUp() throws Exception { try { FileUtils.deleteDirectory(new File( System.getProperty("java.io.tmpdir"), "service-reg-writer")); } catch (Exception e) { } new File(System.getProperty("java.io.tmpdir"), "service-reg-writer").mkdirs(); writer = new Register( new RegisterConfig( new File( System.getProperty("java.io.tmpdir"), "service-reg-writer").getAbsolutePath())); entry = new RegisterEntry( 8080, "host", "module", "context", new Date(), null, 8080); }
@Before public void setUp() throws Exception { try { new File( System.getProperty("java.io.tmpdir"), "service-reg-finder").delete(); } catch (Exception e) { } new File(System.getProperty("java.io.tmpdir"), "service-reg-finder").mkdirs(); registerConfig = new RegisterConfig( new File(System.getProperty("java.io.tmpdir"), "service-reg-finder").getAbsolutePath()); writer = new Register(registerConfig); finder = new Finder(registerConfig); entry = new RegisterEntry( 8080, "host", "module", "context", new Date(), null, 8080); }
@Before public void setUp() throws Exception { try { new File( System.getProperty("java.io.tmpdir"), "lana-service-reg-cleaner").delete(); } catch (Exception e) { } new File( System.getProperty("java.io.tmpdir"), "lana-service-reg-cleaner").mkdirs(); registerConfig = new RegisterConfig( new File( System.getProperty("java.io.tmpdir"), "lana-service-reg-cleaner").getAbsolutePath()); writer = new Register(registerConfig); finder = new Finder(registerConfig); cleaner = new Cleaner(registerConfig, 1); entry = new RegisterEntry( 8080, "host", "module", "context", new Date(), null, 8080); }
containsString("externalPort\":9090")); sendPing(new RegisterEntry( 8081, "use-ip", "hello", "world", new Date(), "my-target", 8082)); Thread.sleep(1000);
@Test public void matches() throws Exception { RegisterEntry re = new RegisterEntry(); re.getManifest().clear(); assertFalse(entry.matches(re));
@Override public void register(ServerData[] data) { try { final String hostname = Optional.ofNullable(customHostname) .orElse(InetAddress.getLocalHost() .getHostName()); application = new Application( Stream.of(data) .map(next -> new RegisterEntry( next.getPort(), hostname, next.getModule().getContext(), next.getModule().getContext(), null, targetEndpoint, externalPort(next))) .collect(Collectors.toList())); logger.info("Registered application {} ", application); } catch (UnknownHostException e) { throw ExceptionSoftener.throwSoftenedException(e); } }