use of io.fabric8.mockwebserver.Context in project keycloak by keycloak.
the class KeycloakController method prepareEventSources.
@Override
public List<EventSource> prepareEventSources(EventSourceContext<Keycloak> context) {
SharedIndexInformer<Deployment> deploymentInformer = client.apps().deployments().inNamespace(context.getConfigurationService().getClientConfiguration().getNamespace()).withLabels(Constants.DEFAULT_LABELS).runnableInformer(0);
EventSource deploymentEvent = new InformerEventSource<>(deploymentInformer, Mappers.fromOwnerReference());
return List.of(deploymentEvent);
}
use of io.fabric8.mockwebserver.Context in project fabric8 by jboss-fuse.
the class ShowConfig method main.
public static void main(String... args) {
try {
System.out.println("Current username: " + currentUserName());
Config config = Configs.parseConfigs();
if (config == null) {
System.out.println("No Config loaded!");
} else {
Context context = Configs.getCurrentContext(config);
if (context != null) {
System.out.println("context: " + config.getCurrentContext());
System.out.println("cluster: " + context.getCluster());
System.out.println("user: " + context.getUser());
System.out.println("namespace: " + context.getNamespace());
} else {
System.out.println("No current context!");
}
}
} catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
}
use of io.fabric8.mockwebserver.Context in project jbosstools-openshift by jbosstools.
the class OdoCli method createService.
@Override
public void createService(String project, String application, ServiceTemplate serviceTemplate, OperatorCRD serviceCRD, String service, ObjectNode spec, boolean wait) throws IOException {
try {
CustomResourceDefinitionContext context = toCustomResourceDefinitionContext(serviceCRD);
ObjectNode payload = serviceCRD.getSample().deepCopy();
updatePayload(payload, spec, project, service);
client.customResource(context).create(project, JSON_MAPPER.writeValueAsString(payload));
UsageStats.getInstance().odoCommand("service create", true);
UsageStats.getInstance().createService(serviceTemplate.getName(), true);
} catch (KubernetesClientException e) {
UsageStats.getInstance().odoCommand("service create", false);
UsageStats.getInstance().createService(serviceTemplate.getName(), false);
throw new IOException(e.getLocalizedMessage(), e);
} catch (IOException e) {
UsageStats.getInstance().odoCommand("service create", false);
UsageStats.getInstance().createService(serviceTemplate.getName(), false);
throw e;
}
}
use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.
the class IconEnricher method getDefaultIconRef.
/**
* Lets use the project and its classpath to try figure out what default icon to use
*
* @return the icon ref if we can detect one or return null
*/
private String getDefaultIconRef() {
MavenProject project = getProject();
EnricherContext context = getContext();
if (hasClass(project, "io.fabric8.funktion.runtime.Main") || MavenUtil.hasDependencyOnAnyArtifactOfGroup(project, "io.fabric8.funktion")) {
return "funktion";
}
if (hasClass(project, "org.apache.camel.CamelContext")) {
return "camel";
}
if (hasPlugin(project, "org.springframework.boot:spring-boot-maven-plugin") || hasClass(project, "org.springframework.boot.SpringApplication")) {
return "spring-boot";
}
if (hasClass(project, "org.springframework.core.Constants")) {
return "spring";
}
if (hasClass(project, "org.vertx.java.core.Handler", "io.vertx.core.Handler")) {
return "vertx";
}
if (hasPlugin(project, "org.wildfly.swarm:wildfly-swarm-plugin") || MavenUtil.hasDependencyOnAnyArtifactOfGroup(project, "org.wildfly.swarm")) {
return "wildfly-swarm";
}
return null;
}
use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method testSchemeWithServerPortAndServerKeystore.
@Test
public void testSchemeWithServerPortAndServerKeystore() {
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Properties props = new Properties();
props.put(propertyHelper.getServerPortPropertyKey(), "8443");
props.put(propertyHelper.getServerKeystorePropertyKey(), "classpath:keystore.p12");
Probe probe = enricher.buildProbe(props, 10, null);
assertNotNull(probe);
assertNotNull(probe.getHttpGet());
assertEquals("HTTPS", probe.getHttpGet().getScheme());
assertEquals(8443, probe.getHttpGet().getPort().getIntVal().intValue());
}
Aggregations