@Test public void testAgent() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/discovery/agent/") .contentType(MimeTypeUtils.APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(content().string("docker run --name havenAgent -d" + " -e \"dm_agent_notifier_server=http: " -e \"dm_agent_notifier_secret=secr3t\" " + "--restart=unless-stopped -p 8771:8771 -v /run/docker.sock:/run/docker.sock codeabovelab/agent:latest")); }
@RequestMapping(value = "/agent/", method = GET) public String agent(HttpServletRequest request) { return StrSubstitutor.replace(startString, of("secret", nodeSecret == null ? "" : "-e \"dm_agent_notifier_secret=" + nodeSecret + "\"", "server", getServerAddress(request)), "{", "}"); }
DiscoveryNodeController { @RequestMapping(value = "/agent/", method = GET) public String agent(HttpServletRequest request) { return StrSubstitutor.replace(startString, of("secret", nodeSecret == null ? "" : "-e \"dm_agent_notifier_secret=" + nodeSecret + "\"", "server", getServerAddress(request)), "{", "}"); } }
DiscoveryNodeController { @RequestMapping(value = "/agent/", method = GET) public String agent(HttpServletRequest request) { return StrSubstitutor.replace(startString, of("secret", nodeSecret == null ? "" : "-e \"dm_agent_notifier_secret=" + nodeSecret + "\"", "server", getServerAddress(request)), "{", "}"); } @Autowired  DiscoveryNodeController(NodeStorage storage,
                                   @Value("${dm.agent.notifier.secret:}") String nodeSecret,
                                   @Value("${dm.agent.start}") String startString); }
DiscoveryNodeController { @RequestMapping(value = "/agent/", method = GET) public String agent(HttpServletRequest request) { return StrSubstitutor.replace(startString, of("secret", nodeSecret == null ? "" : "-e \"dm_agent_notifier_secret=" + nodeSecret + "\"", "server", getServerAddress(request)), "{", "}"); } @Autowired  DiscoveryNodeController(NodeStorage storage,
                                   @Value("${dm.agent.notifier.secret:}") String nodeSecret,
                                   @Value("${dm.agent.start}") String startString); @RequestMapping(value = "/nodes/{name}", method = POST, consumes = {TEXT_PLAIN_VALUE, APPLICATION_JSON_VALUE}) ResponseEntity<String> registerNodeFromAgent(@RequestBody NotifierData data,
                                                        @PathVariable("name") String name,
                                                        @RequestHeader(name = NotifierData.HEADER, required = false) String nodeSecret,
                                                        @RequestParam(value = "ttl", required = false) Integer ttl,
                                                        HttpServletRequest request); @RequestMapping(value = "/agent/", method = GET) String agent(HttpServletRequest request); }
DiscoveryNodeController { @RequestMapping(value = "/agent/", method = GET) public String agent(HttpServletRequest request) { return StrSubstitutor.replace(startString, of("secret", nodeSecret == null ? "" : "-e \"dm_agent_notifier_secret=" + nodeSecret + "\"", "server", getServerAddress(request)), "{", "}"); } @Autowired  DiscoveryNodeController(NodeStorage storage,
                                   @Value("${dm.agent.notifier.secret:}") String nodeSecret,
                                   @Value("${dm.agent.start}") String startString); @RequestMapping(value = "/nodes/{name}", method = POST, consumes = {TEXT_PLAIN_VALUE, APPLICATION_JSON_VALUE}) ResponseEntity<String> registerNodeFromAgent(@RequestBody NotifierData data,
                                                        @PathVariable("name") String name,
                                                        @RequestHeader(name = NotifierData.HEADER, required = false) String nodeSecret,
                                                        @RequestParam(value = "ttl", required = false) Integer ttl,
                                                        HttpServletRequest request); @RequestMapping(value = "/agent/", method = GET) String agent(HttpServletRequest request);  }