use of io.fabric8.knative.serving.v1.Service in project jointware by isdream.
the class KubernetesKeyValueStyleGeneratorTest method testKubernetesWithAllKind.
protected static void testKubernetesWithAllKind() throws Exception {
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ServiceAccount());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ThirdPartyResource());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ResourceQuota());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Node());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ConfigMap());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new NetworkPolicy());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new CustomResourceDefinition());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Ingress());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Service());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Namespace());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Secret());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new LimitRange());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Event());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new PersistentVolume());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new StatefulSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new PersistentVolumeClaim());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new DaemonSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new HorizontalPodAutoscaler());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Pod());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ReplicaSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Job());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ReplicationController());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Deployment());
}
use of io.fabric8.knative.serving.v1.Service in project fabric8 by jboss-fuse.
the class Logs method newInstance.
public static LogEvent newInstance(PaxLoggingEvent event) {
LogEvent answer = new LogEvent();
try {
answer.setLevel(toString(event.getLevel()));
} catch (NoClassDefFoundError error) {
// ENTESB-2234, KARAF-3350: Ignore NoClassDefFoundError exceptions
// Those exceptions may happen if the underlying pax-logging service
// bundle has been refreshed somehow.
answer.setLevel("LOG");
}
answer.setMessage(event.getMessage());
answer.setLogger(event.getLoggerName());
answer.setTimestamp(new Date(event.getTimeStamp()));
answer.setThread(event.getThreadName());
answer.setException(addMavenCoord(event.getThrowableStrRep()));
Map eventProperties = event.getProperties();
if (eventProperties != null && eventProperties.size() > 0) {
Map<String, String> properties = new HashMap<String, String>();
Set<Map.Entry> set = eventProperties.entrySet();
for (Map.Entry entry : set) {
Object key = entry.getKey();
Object value = entry.getValue();
if (key != null && value != null) {
properties.put(toString(key), toString(value));
}
}
MavenCoordinates.addMavenCoord(properties);
answer.setProperties(properties);
}
// event.getFQNOfLoggerClass()
try {
PaxLocationInfo locationInformation = event.getLocationInformation();
if (locationInformation != null) {
answer.setClassName(locationInformation.getClassName());
answer.setFileName(locationInformation.getFileName());
answer.setMethodName(locationInformation.getMethodName());
answer.setLineNumber(locationInformation.getLineNumber());
}
} catch (NoClassDefFoundError error) {
// ENTESB-2234, KARAF-3350: Ignore NoClassDefFoundError exceptions
}
return answer;
}
use of io.fabric8.knative.serving.v1.Service in project fabric8 by jboss-fuse.
the class ExampleCxfProfileLongTest method testExample.
@Test
public void testExample() throws Exception {
System.out.println("creating the cxf-server container.");
ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
try {
Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("child").withProfiles("example-cxf-cxf.server").assertProvisioningResult().build();
try {
assertTrue("We should create the cxf-server container.", containers.size() == 1);
System.out.println("created the cxf-server container.");
// install bundle of CXF
Thread.sleep(2000);
System.out.println(executeCommand("fabric:cluster-list"));
// install bundle of CXF
Thread.sleep(2000);
// calling the client here
System.out.println("install the cxf client demo in root container");
// This test need to take sometime to download the cxf feature related bundles
System.out.println(executeCommand("features:install fabric-cxf", 600000, false));
String projectVersion = System.getProperty("fabricitest.version");
// install bundle of CXF demo client
System.out.println(executeCommand("osgi:install -s mvn:io.fabric8.examples/fabric-cxf-demo-common/" + projectVersion));
System.out.println(executeCommand("osgi:install -s mvn:io.fabric8.examples/fabric-cxf-demo-client/" + projectVersion));
System.out.println(executeCommand("osgi:list"));
System.out.println("invoking the web service");
Hello proxy = ServiceLocator.awaitService(bundleContext, Hello.class);
assertNotNull(proxy);
String result1 = proxy.sayHello();
String result2 = proxy.sayHello();
assertNotSame("We should get the two different result", result1, result2);
} finally {
ContainerBuilder.destroy(containers);
}
} finally {
fabricProxy.close();
}
}
use of io.fabric8.knative.serving.v1.Service in project fabric8 by jboss-fuse.
the class TcpGatewayHandler method handle.
@Override
public void handle(final NetSocket socket) {
NetClient client = null;
List<String> paths = serviceMap.getPaths();
TcpClientRequestFacade requestFacade = new TcpClientRequestFacade(socket);
String path = pathLoadBalancer.choose(paths, requestFacade);
if (path != null) {
List<ServiceDetails> services = serviceMap.getServices(path);
if (!services.isEmpty()) {
ServiceDetails serviceDetails = serviceLoadBalancer.choose(services, requestFacade);
if (serviceDetails != null) {
List<String> urlStrings = serviceDetails.getServices();
for (String urlString : urlStrings) {
if (Strings.notEmpty(urlString)) {
// lets create a client for this request...
try {
URI uri = new URI(urlString);
// URL url = new URL(urlString);
String urlProtocol = uri.getScheme();
if (Objects.equal(protocol, urlProtocol)) {
Handler<AsyncResult<NetSocket>> handler = new Handler<AsyncResult<NetSocket>>() {
public void handle(final AsyncResult<NetSocket> asyncSocket) {
socket.resume();
NetSocket clientSocket = asyncSocket.result();
Pump.createPump(clientSocket, socket).start();
Pump.createPump(socket, clientSocket).start();
}
};
client = createClient(socket, uri, handler);
break;
}
} catch (MalformedURLException e) {
LOG.warn("Failed to parse URL: " + urlString + ". " + e, e);
} catch (URISyntaxException e) {
LOG.warn("Failed to parse URI: " + urlString + ". " + e, e);
}
}
}
}
}
}
if (client == null) {
// fail to route
LOG.info("No service available for protocol " + protocol + " for paths " + paths);
socket.close();
}
}
use of io.fabric8.knative.serving.v1.Service in project fabric8 by jboss-fuse.
the class ServiceImplTest method testLoadWithPrereqs.
@Test
public void testLoadWithPrereqs() throws IOException {
ServiceImpl service = createMockServiceImpl();
PatchData pd = PatchData.load(getClass().getClassLoader().getResourceAsStream("test-with-prereq.patch"));
assertEquals(2, pd.getBundles().size());
assertEquals(1, pd.getRequirements().size());
assertTrue(pd.getRequirements().contains("prereq1"));
assertNull(pd.getVersionRange("mvn:io.fabric8.test/test2/1.0.0"));
}
Aggregations