Commit 135ff1b9 authored by Philippe Merle's avatar Philippe Merle

Moved introspectNuxeoFramework() from module frascati-implementation-nuxeo to...

Moved introspectNuxeoFramework() from module frascati-implementation-nuxeo to frascati-implementation-nuxeo/examples/nuxeo.
parent c2a19ac4
......@@ -30,8 +30,12 @@ package org.ow2.frascati.nuxeo.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.runtime.RuntimeService;
import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.api.login.LoginService;
import org.nuxeo.runtime.api.login.SecurityDomain;
import org.nuxeo.runtime.model.ComponentName;
import org.nuxeo.runtime.model.RegistrationInfo;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
......@@ -48,6 +52,44 @@ import org.ow2.frascati.FraSCAti;
@Features(MinimalistNuxeoFeature.class)
public class TestNuxeo
{
@Test
public void introspectNuxeoFramework() throws Exception
{
RuntimeService runtimeService = Framework.getRuntime();
System.out.println(runtimeService.getDescription());
System.out.println("Framework.getRuntime().getComponentManager().getRegistrations():");
for(RegistrationInfo registrationInfo : runtimeService.getComponentManager().getRegistrations()) {
System.out.println("* " + registrationInfo);
System.out.println(" - bundle: " + registrationInfo.getBundle());
System.out.println(" - component: " + registrationInfo.getComponent());
// System.out.println(" - documentation: " + registrationInfo.getDocumentation());
System.out.println(" - implementation: " + registrationInfo.getImplementation());
System.out.println(" - name: " + registrationInfo.getName());
System.out.println(" - provided service names:");
String[] providedServiceNames = registrationInfo.getProvidedServiceNames();
if(providedServiceNames != null) {
for(String providedServiceName : providedServiceNames) {
System.out.println(" - " + providedServiceName);
}
}
System.out.println(" - required components:");
java.util.Set<ComponentName> requiredComponents = registrationInfo.getRequiredComponents();
if(requiredComponents != null) {
for(ComponentName requiredComponent : requiredComponents) {
System.out.println(" - " + requiredComponent);
}
}
System.out.println(" - version: " + registrationInfo.getVersion());
}
System.out.println("Framework.getRuntime().getComponentManager().getServices():");
for(String service : runtimeService.getComponentManager().getServices()) {
System.out.print("* " + service);
Class<?> serviceClass = Class.forName(service);
Object serviceObject = runtimeService.getComponentManager().getService(serviceClass);
System.out.println(" is " + serviceObject);
}
}
/**
* Test the Nuxeo composite.
*/
......@@ -64,5 +106,7 @@ public class TestNuxeo
for(SecurityDomain securityDomain : loginService.getSecurityDomains()) {
System.out.println("* " + securityDomain);
}
// Thread.sleep(5*60*1000);
}
}
......@@ -34,10 +34,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.runtime.RuntimeService;
import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.model.ComponentName;
import org.nuxeo.runtime.model.RegistrationInfo;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
......@@ -57,45 +53,6 @@ import org.ow2.frascati.assembly.factory.api.ProcessingContext;
@Features(MinimalistNuxeoFeature.class)
public class TestNuxeo
{
@Test
public void introspectNuxeoFramework() throws Exception
{
RuntimeService runtimeService = Framework.getRuntime();
System.out.println(runtimeService.getDescription());
System.out.println("Framework.getRuntime().getComponentManager().getRegistrations():");
for(RegistrationInfo registrationInfo : runtimeService.getComponentManager().getRegistrations()) {
System.out.println("* " + registrationInfo);
System.out.println(" - bundle: " + registrationInfo.getBundle());
System.out.println(" - component: " + registrationInfo.getComponent());
System.out.println(" - documentation: " + registrationInfo.getDocumentation());
System.out.println(" - implementation: " + registrationInfo.getImplementation());
System.out.println(" - name: " + registrationInfo.getName());
System.out.println(" - provided service names:");
String[] providedServiceNames = registrationInfo.getProvidedServiceNames();
if(providedServiceNames != null) {
for(String providedServiceName : providedServiceNames) {
System.out.println(" - " + providedServiceName);
}
}
System.out.println(" - required components:");
java.util.Set<ComponentName> requiredComponents = registrationInfo.getRequiredComponents();
if(requiredComponents != null) {
for(ComponentName requiredComponent : requiredComponents) {
System.out.println(" - " + requiredComponent);
}
}
System.out.println(" - version: " + registrationInfo.getVersion());
}
System.out.println("Framework.getRuntime().getComponentManager().getServices():");
for(String service : runtimeService.getComponentManager().getServices()) {
System.out.print("* " + service);
Class<?> serviceClass = Class.forName(service);
Object serviceObject = runtimeService.getComponentManager().getService(serviceClass);
System.out.println(" is " + serviceObject);
}
}
FraSCAti frascati;
CompositeManager compositeManager;
......@@ -121,5 +78,4 @@ public class TestNuxeo
assertEquals("The number of checking warnings", 3, processingContext.getWarnings());
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment