@Test public void getExecProbeWithExecTest() { probeConfig = new ProbeConfig.Builder() .initialDelaySeconds(5).timeoutSeconds(5).exec("cat /tmp/probe") .build(); probe = probeHandler.getProbe(probeConfig); assertNotNull(probe); assertEquals(5,probe.getInitialDelaySeconds().intValue()); assertEquals(5,probe.getTimeoutSeconds().intValue()); assertNotNull(probe.getExec()); assertEquals(2,probe.getExec().getCommand().size()); assertEquals("[cat, /tmp/probe]",probe.getExec().getCommand().toString()); assertNull(probe.getHttpGet()); assertNull(probe.getTcpSocket()); }
public Probe getProbe(ProbeConfig probeConfig) { if (probeConfig == null) { return null; } Probe probe = new Probe(); Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds(); if (initialDelaySeconds != null) { probe.setInitialDelaySeconds(initialDelaySeconds); } Integer timeoutSeconds = probeConfig.getTimeoutSeconds(); if (timeoutSeconds != null) { probe.setTimeoutSeconds(timeoutSeconds); } Integer failureThreshold = probeConfig.getFailureThreshold(); if(failureThreshold != null) { probe.setFailureThreshold(failureThreshold); } Integer successThreshold = probeConfig.getSuccessThreshold(); if(successThreshold != null) { probe.setSuccessThreshold(successThreshold); } HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl()); if (getAction != null) { probe.setHttpGet(getAction); return probe; } ExecAction execAction = getExecAction(probeConfig.getExec()); if (execAction != null) { probe.setExec(execAction); return probe; } TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort()); if (tcpSocketAction != null) { probe.setTcpSocket(tcpSocketAction); return probe; } return null; }
ProbeHandler { public Probe getProbe(ProbeConfig probeConfig) { if (probeConfig == null) { return null; } Probe probe = new Probe(); Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds(); if (initialDelaySeconds != null) { probe.setInitialDelaySeconds(initialDelaySeconds); } Integer timeoutSeconds = probeConfig.getTimeoutSeconds(); if (timeoutSeconds != null) { probe.setTimeoutSeconds(timeoutSeconds); } Integer failureThreshold = probeConfig.getFailureThreshold(); if(failureThreshold != null) { probe.setFailureThreshold(failureThreshold); } Integer successThreshold = probeConfig.getSuccessThreshold(); if(successThreshold != null) { probe.setSuccessThreshold(successThreshold); } HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl()); if (getAction != null) { probe.setHttpGet(getAction); return probe; } ExecAction execAction = getExecAction(probeConfig.getExec()); if (execAction != null) { probe.setExec(execAction); return probe; } TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort()); if (tcpSocketAction != null) { probe.setTcpSocket(tcpSocketAction); return probe; } return null; } }
ProbeHandler { public Probe getProbe(ProbeConfig probeConfig) { if (probeConfig == null) { return null; } Probe probe = new Probe(); Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds(); if (initialDelaySeconds != null) { probe.setInitialDelaySeconds(initialDelaySeconds); } Integer timeoutSeconds = probeConfig.getTimeoutSeconds(); if (timeoutSeconds != null) { probe.setTimeoutSeconds(timeoutSeconds); } Integer failureThreshold = probeConfig.getFailureThreshold(); if(failureThreshold != null) { probe.setFailureThreshold(failureThreshold); } Integer successThreshold = probeConfig.getSuccessThreshold(); if(successThreshold != null) { probe.setSuccessThreshold(successThreshold); } HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl()); if (getAction != null) { probe.setHttpGet(getAction); return probe; } ExecAction execAction = getExecAction(probeConfig.getExec()); if (execAction != null) { probe.setExec(execAction); return probe; } TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort()); if (tcpSocketAction != null) { probe.setTcpSocket(tcpSocketAction); return probe; } return null; }  }
ProbeHandler { public Probe getProbe(ProbeConfig probeConfig) { if (probeConfig == null) { return null; } Probe probe = new Probe(); Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds(); if (initialDelaySeconds != null) { probe.setInitialDelaySeconds(initialDelaySeconds); } Integer timeoutSeconds = probeConfig.getTimeoutSeconds(); if (timeoutSeconds != null) { probe.setTimeoutSeconds(timeoutSeconds); } Integer failureThreshold = probeConfig.getFailureThreshold(); if(failureThreshold != null) { probe.setFailureThreshold(failureThreshold); } Integer successThreshold = probeConfig.getSuccessThreshold(); if(successThreshold != null) { probe.setSuccessThreshold(successThreshold); } HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl()); if (getAction != null) { probe.setHttpGet(getAction); return probe; } ExecAction execAction = getExecAction(probeConfig.getExec()); if (execAction != null) { probe.setExec(execAction); return probe; } TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort()); if (tcpSocketAction != null) { probe.setTcpSocket(tcpSocketAction); return probe; } return null; }  Probe getProbe(ProbeConfig probeConfig); }
ProbeHandler { public Probe getProbe(ProbeConfig probeConfig) { if (probeConfig == null) { return null; } Probe probe = new Probe(); Integer initialDelaySeconds = probeConfig.getInitialDelaySeconds(); if (initialDelaySeconds != null) { probe.setInitialDelaySeconds(initialDelaySeconds); } Integer timeoutSeconds = probeConfig.getTimeoutSeconds(); if (timeoutSeconds != null) { probe.setTimeoutSeconds(timeoutSeconds); } Integer failureThreshold = probeConfig.getFailureThreshold(); if(failureThreshold != null) { probe.setFailureThreshold(failureThreshold); } Integer successThreshold = probeConfig.getSuccessThreshold(); if(successThreshold != null) { probe.setSuccessThreshold(successThreshold); } HTTPGetAction getAction = getHTTPGetAction(probeConfig.getGetUrl()); if (getAction != null) { probe.setHttpGet(getAction); return probe; } ExecAction execAction = getExecAction(probeConfig.getExec()); if (execAction != null) { probe.setExec(execAction); return probe; } TCPSocketAction tcpSocketAction = getTCPSocketAction(probeConfig.getGetUrl(), probeConfig.getTcpPort()); if (tcpSocketAction != null) { probe.setTcpSocket(tcpSocketAction); return probe; } return null; }  Probe getProbe(ProbeConfig probeConfig);  }