@Test public void testGetConnector() throws Exception { System.out.println("getConnector"); String host = ""; int port = 0; PerfMonCollector instance = new PerfMonCollector(); PerfMonAgentConnector expResult = null; try { PerfMonAgentConnector result = instance.getConnector(host, port); fail(); } catch (IOException e) { } }
protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; } }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; } PerfMonCollector(); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); }
PerfMonCollector extends CorrectedResultCollector implements Runnable, PerfMonSampleGenerator { protected PerfMonAgentConnector getConnector(String host, int port) throws IOException { log.debug("Trying new connector"); SocketAddress addr = new InetSocketAddress(host, port); Transport transport; try { transport = TransportFactory.TCPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via TCP"); } } catch (IOException e) { log.info("Can't connect TCP transport for host: " + addr.toString(), e); boolean useUDP = JMeterUtils.getPropDefault("jmeterPlugin.perfmon.useUDP", false); if (!useUDP) { throw e; } else { try { log.debug("Connecting UDP"); transport = TransportFactory.UDPInstance(addr); if (!transport.test()) { throw new IOException("Agent is unreachable via UDP"); } } catch (IOException ex) { log.info("Can't connect UDP transport for host: " + addr.toString(), ex); throw ex; } } } NewAgentConnector conn = new NewAgentConnector(); conn.setTransport(transport); transport.setInterval(interval); return conn; } PerfMonCollector(); void setData(CollectionProperty rows); JMeterProperty getMetricSettings(); void sampleOccurred(SampleEvent event); @Override synchronized void run(); @Override void testStarted(String host); @Override void testEnded(String host); @Override void generateSample(double value, String label); @Override void generateErrorSample(String label, String errorMsg); @Override void generate2Samples(long[] values, String label1, String label2); @Override void generate2Samples(long[] values, String label1, String label2, double dividingFactor); static LinkedList<String> getFiles(); static void clearFiles(); static final String DATA_PROPERTY; }