Search in sources :

Example 1 with Container

use of com.yahoo.container.di.Container in project vespa by vespa-engine.

the class ContainerTestBase method complete.

public void complete() {
    try {
        Container container = new Container(new CloudSubscriberFactory(dirConfigSource().configSource()), dirConfigSource().configId(), new ContainerTest.TestDeconstructor(), new Osgi() {

            @SuppressWarnings("unchecked")
            @Override
            public Class<Object> resolveClass(BundleInstantiationSpecification spec) {
                try {
                    return (Class<Object>) Class.forName(spec.classId.getName());
                } catch (ClassNotFoundException e) {
                    throw new RuntimeException(e);
                }
            }

            @Override
            public BundleClasses getBundleClasses(ComponentSpecification bundle, Set<String> packagesToScan) {
                throw new UnsupportedOperationException("getBundleClasses not supported");
            }

            @Override
            public void useBundles(Collection<FileReference> bundles) {
            }

            @Override
            public Bundle getBundle(ComponentSpecification spec) {
                throw new UnsupportedOperationException("getBundle not supported.");
            }
        });
        componentGraph = container.runOnce(componentGraph, Guice.createInjector());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Osgi(com.yahoo.container.di.Osgi) ComponentSpecification(com.yahoo.component.ComponentSpecification) Bundle(org.osgi.framework.Bundle) CloudSubscriberFactory(com.yahoo.container.di.CloudSubscriberFactory) BundleInstantiationSpecification(com.yahoo.container.bundle.BundleInstantiationSpecification) ContainerTest(com.yahoo.container.di.ContainerTest) Container(com.yahoo.container.di.Container) FileReference(com.yahoo.config.FileReference)

Aggregations

ComponentSpecification (com.yahoo.component.ComponentSpecification)1 FileReference (com.yahoo.config.FileReference)1 BundleInstantiationSpecification (com.yahoo.container.bundle.BundleInstantiationSpecification)1 CloudSubscriberFactory (com.yahoo.container.di.CloudSubscriberFactory)1 Container (com.yahoo.container.di.Container)1 ContainerTest (com.yahoo.container.di.ContainerTest)1 Osgi (com.yahoo.container.di.Osgi)1 Bundle (org.osgi.framework.Bundle)1