@Test public void test() { final List<JavaInformations> javaInformationsList = new ArrayList<JavaInformations>(); javaInformationsList.add(new JavaInformations(null, false)); javaInformationsList.add(new JavaInformations(null, false)); assertEquals("getMetricsPublishers", 0, MetricsPublisher.getMetricsPublishers(javaInformationsList).size()); setProperty(Parameter.GRAPHITE_ADDRESS, "localhost:2003"); setProperty(Parameter.STATSD_ADDRESS, "localhost:8125"); setProperty(Parameter.CLOUDWATCH_NAMESPACE, "MyCompany/MyAppDomain"); System.setProperty("aws.region", "us-west-1"); setProperty(Parameter.INFLUXDB_URL, "http: setProperty(Parameter.DATADOG_API_KEY, "9775a026f1ca7d1c6c5af9d94d9595a4"); assertEquals("getMetricsPublishers", 5, MetricsPublisher.getMetricsPublishers(javaInformationsList).size()); }
public static List<MetricsPublisher> getMetricsPublishers( List<JavaInformations> javaInformationsList) { assert javaInformationsList != null && !javaInformationsList.isEmpty(); final StringBuilder sb = new StringBuilder(); for (final JavaInformations javaInformations : javaInformationsList) { if (sb.length() != 0) { sb.append('_'); } sb.append(javaInformations.getHost().replaceFirst("@.*", "")); } String contextPath = Parameter.APPLICATION_NAME.getValue(); if (contextPath == null) { contextPath = javaInformationsList.get(0).getContextPath(); } if (contextPath == null) { contextPath = "NA"; } else if (contextPath.isEmpty()) { contextPath = "/"; } final String hosts = sb.toString(); return getMetricsPublishers(contextPath, hosts); }
MetricsPublisher { public static List<MetricsPublisher> getMetricsPublishers( List<JavaInformations> javaInformationsList) { assert javaInformationsList != null && !javaInformationsList.isEmpty(); final StringBuilder sb = new StringBuilder(); for (final JavaInformations javaInformations : javaInformationsList) { if (sb.length() != 0) { sb.append('_'); } sb.append(javaInformations.getHost().replaceFirst("@.*", "")); } String contextPath = Parameter.APPLICATION_NAME.getValue(); if (contextPath == null) { contextPath = javaInformationsList.get(0).getContextPath(); } if (contextPath == null) { contextPath = "NA"; } else if (contextPath.isEmpty()) { contextPath = "/"; } final String hosts = sb.toString(); return getMetricsPublishers(contextPath, hosts); } }
MetricsPublisher { public static List<MetricsPublisher> getMetricsPublishers( List<JavaInformations> javaInformationsList) { assert javaInformationsList != null && !javaInformationsList.isEmpty(); final StringBuilder sb = new StringBuilder(); for (final JavaInformations javaInformations : javaInformationsList) { if (sb.length() != 0) { sb.append('_'); } sb.append(javaInformations.getHost().replaceFirst("@.*", "")); } String contextPath = Parameter.APPLICATION_NAME.getValue(); if (contextPath == null) { contextPath = javaInformationsList.get(0).getContextPath(); } if (contextPath == null) { contextPath = "NA"; } else if (contextPath.isEmpty()) { contextPath = "/"; } final String hosts = sb.toString(); return getMetricsPublishers(contextPath, hosts); }  }
MetricsPublisher { public static List<MetricsPublisher> getMetricsPublishers( List<JavaInformations> javaInformationsList) { assert javaInformationsList != null && !javaInformationsList.isEmpty(); final StringBuilder sb = new StringBuilder(); for (final JavaInformations javaInformations : javaInformationsList) { if (sb.length() != 0) { sb.append('_'); } sb.append(javaInformations.getHost().replaceFirst("@.*", "")); } String contextPath = Parameter.APPLICATION_NAME.getValue(); if (contextPath == null) { contextPath = javaInformationsList.get(0).getContextPath(); } if (contextPath == null) { contextPath = "NA"; } else if (contextPath.isEmpty()) { contextPath = "/"; } final String hosts = sb.toString(); return getMetricsPublishers(contextPath, hosts); }  static List<MetricsPublisher> getMetricsPublishers(
			List<JavaInformations> javaInformationsList); abstract void addValue(String metric, double value); abstract void send(); abstract void stop(); }
MetricsPublisher { public static List<MetricsPublisher> getMetricsPublishers( List<JavaInformations> javaInformationsList) { assert javaInformationsList != null && !javaInformationsList.isEmpty(); final StringBuilder sb = new StringBuilder(); for (final JavaInformations javaInformations : javaInformationsList) { if (sb.length() != 0) { sb.append('_'); } sb.append(javaInformations.getHost().replaceFirst("@.*", "")); } String contextPath = Parameter.APPLICATION_NAME.getValue(); if (contextPath == null) { contextPath = javaInformationsList.get(0).getContextPath(); } if (contextPath == null) { contextPath = "NA"; } else if (contextPath.isEmpty()) { contextPath = "/"; } final String hosts = sb.toString(); return getMetricsPublishers(contextPath, hosts); }  static List<MetricsPublisher> getMetricsPublishers(
			List<JavaInformations> javaInformationsList); abstract void addValue(String metric, double value); abstract void send(); abstract void stop();  }