use of io.fabric8.insight.metrics.model.Server in project vertx-openshift-it by cescoffier.
the class MqttIT method initialize.
@BeforeClass
public static void initialize() throws IOException {
File template = new File("target/classes/META-INF/fabric8/openshift.yml");
ensureThat(String.format("template file %s can be deployed", template), () -> deploymentAssistant.deploy("mqtt-broker", template));
ensureThat("the mqtt server is up and running", () -> await("Waiting for the mqtt server to be ready..").atMost(5, TimeUnit.MINUTES).untilAsserted(() -> {
Service service = client.services().withName("mqtt-secured-service").get();
assertThat(service).isNotNull();
assertThat(client.deploymentConfigs().withName("vertx-mqtt-it").isReady()).isTrue();
}));
mqttRoute = securedUrlForRoute(client.routes().withName("mqtt-secured-route").get()).getHost();
/* on OSO, the only way to test the insecure MQTT client connecting to server running in OpenShift
is through port forwarding. */
String pod = OC.executeWithQuotes(false, "get", "po", "--selector", "app=vertx-mqtt-it", "-o", "jsonpath='{.items[0].metadata.name}'").replace("'", "");
p1 = Runtime.getRuntime().exec("oc port-forward " + pod + " :1883");
BufferedReader reader = new BufferedReader(new InputStreamReader(p1.getInputStream()));
Pattern pattern = Pattern.compile(".*:(\\d+)");
Matcher matcher = pattern.matcher(reader.readLine());
String podString = "";
while (matcher.find()) {
podString = matcher.group(1);
}
port = Integer.parseInt(podString);
vertx = Vertx.vertx();
mqttSecuredClient = clientSetup(MqttClient.create(vertx, mqttClientOptions));
mqttInsecureClient = clientSetup(MqttClient.create(vertx));
}
use of io.fabric8.insight.metrics.model.Server in project vertx-openshift-it by cescoffier.
the class SockJsIT method checkSockStatuses.
@Test
public void checkSockStatuses() throws InterruptedException {
ensureThat("we can navigate to application ", () -> {
final Route route = client.routes().withName(deploymentAssistant.applicationName()).get();
webDriver.navigate().to(urlForRoute(route));
});
ensureThat("both statuses are updated", () -> {
await().atMost(3, TimeUnit.MINUTES).catchUncaughtExceptions().until(() -> isElementEmpty(EB_STATUS));
await().atMost(3, TimeUnit.MINUTES).catchUncaughtExceptions().until(() -> isElementEmpty(SOCK_STATUS));
});
ensureThat("all transports are working and asserted", () -> {
final JsonPath serverStatus = get("/status").body().jsonPath();
final JsonObject clientSideEbStatus = getJsonById(EB_STATUS);
final JsonObject clientSideSockStatus = getJsonById(SOCK_STATUS);
for (Transport t : Transport.values()) {
softly.assertThat(serverStatus.getBoolean(t + "-EB")).as("Transport " + t + " should be used on server side (on EventBus). ").isTrue();
softly.assertThat(serverStatus.getBoolean(t + "-sock")).as("Transport " + t + " should be used on server side (on SockJS). ").isTrue();
softly.assertThat(clientSideEbStatus.getInteger(t.name())).as("Transport " + t + " should be used on client side (on EventBus). ").isGreaterThan(0);
softly.assertThat(clientSideSockStatus.getInteger(t.name())).as("Transport " + t + " should be used on client side (on SockJS). ").isGreaterThan(0);
}
});
}
use of io.fabric8.insight.metrics.model.Server in project syndesis by syndesisio.
the class PrometheusMetricsProviderImplTest method setUp.
@Before
public void setUp() {
final PrometheusConfigurationProperties config = new PrometheusConfigurationProperties();
config.setService("syndesis-prometheus-syndesis.192.168.64.22.nip.io");
NamespacedOpenShiftClient openshiftClient = mock(NamespacedOpenShiftClient.class);
when(openshiftClient.pods().withName("syndesis-server").get().getStatus().getStartTime()).thenReturn("2018-03-14T23:34:09Z");
metricsProvider = new PrometheusMetricsProviderImpl(config, openshiftClient);
}
use of io.fabric8.insight.metrics.model.Server in project fabric8 by fabric8io.
the class ListEnvironments method main.
public static void main(String[] args) {
KubernetesClient kubernetesClient = new DefaultKubernetesClient();
Environments environments;
if (args.length > 0) {
String namespace = args[0];
System.out.println("Listing environments for namespace: " + namespace);
environments = Environments.load(namespace);
} else {
environments = Environments.load();
}
String environmentKey = "testing";
if (args.length > 1) {
environmentKey = args[1];
}
System.out.println("Space namespace: " + environments.getNamespace());
SortedSet<Environment> set = environments.getEnvironmentSet();
for (Environment environment : set) {
String onCluster = "";
String clusterAPiServer = environment.getClusterAPiServer();
if (Strings.isNotBlank(clusterAPiServer)) {
onCluster += " on API server: " + clusterAPiServer;
}
System.out.println("Environment " + environment.getName() + " maps to namespace: " + environment.getNamespace() + onCluster);
}
System.out.println("Namespace for environment key: " + environmentKey + " is " + Environments.namespaceForEnvironment(environmentKey));
}
use of io.fabric8.insight.metrics.model.Server in project fabric8 by fabric8io.
the class CamelState method doCheck.
@Override
protected List<Check> doCheck() {
MBeanServer server = this.mbeanServer.getService();
if (server != null) {
try {
List<Check> checks = new ArrayList<>();
Set<ObjectName> contexts = server.queryNames(new ObjectName("org.apache.camel:type=context,*"), null);
for (ObjectName ctxName : contexts) {
String state = server.getAttribute(ctxName, "State").toString();
if (!"Started".equals(state)) {
String name = ctxName.getKeyProperty("name");
checks.add(new Check("camel-state", "Camel context " + name + " is in state " + state));
}
}
return checks;
} catch (Exception e) {
return Collections.singletonList(new Check("camel-state", "Unable to check camel contexts: " + e.toString()));
}
}
return Collections.emptyList();
}
Aggregations