FileDocCategorySizeDatePackage
TestFeedRegistry.javaAPI DocApache Lucene 2.1.05282Wed Feb 14 10:46:02 GMT 2007org.apache.lucene.gdata.server.registry

TestFeedRegistry

public class TestFeedRegistry extends TestCase
author
Simon Willnauer

Fields Summary
private GDataServerRegistry
reg
private ProvidedServiceConfig
configurator
Constructors Summary
Methods Summary
private voidregisterService(java.lang.String servicename)


        this.configurator.setName(servicename);
        this.reg.registerService(this.configurator);
    
protected voidsetUp()

        this.reg = GDataServerRegistry.getRegistry();
        this.configurator = new ProvidedServiceConfig();
        this.configurator.setEntryType(Entry.class);
        this.configurator.setFeedType(Feed.class);
        this.configurator.setExtensionProfile(new ExtensionProfile());
    
protected voidtearDown()

see
junit.framework.TestCase#tearDown()

        this.reg.flushRegistry();

    
public voidtestFlushRegistry()
Test method for 'org.apache.lucene.gdata.server.registry.FeedRegistry.getFeedConfigurator(String)'

        String service = "service";
        registerService(service);

        assertEquals("Registered Configurator", this.configurator, this.reg
                .getProvidedService(service));
        this.reg.flushRegistry();
        assertNull("Registry flushed", this.reg.getProvidedService(service));

    
public voidtestGetRegistry()
Test method for 'org.apache.lucene.gdata.server.registry.FeedRegistry.getRegistry()'


        GDataServerRegistry reg1 = GDataServerRegistry.getRegistry();
        assertEquals("test singleton", this.reg, reg1);
    
public voidtestIsFeedRegistered()

        String service = "service";
        registerService(service);
        assertTrue("Feed is registerd", this.reg.isServiceRegistered(service));
        assertFalse("null Feed is not registerd", this.reg
                .isServiceRegistered(null));
        assertFalse("Feed is not registerd", this.reg
                .isServiceRegistered("something"));

    
public voidtestRegisterComponent()

        try {
            this.reg.registerComponent(StorageController.class, null);
            fail("RegistryException expected");
        } catch (RegistryException e) {
            //
        }
        new GDataRequestListener();
        try {
            this.reg.registerComponent(StorageCoreController.class, null);
            fail("no config");
        } catch (Exception e) {
            // TODO: handle exception
        }
        this.reg.registerComponent(DefaultRequestHandlerFactory.class, null);
        RequestHandlerFactory factory = this.reg.lookup(
                RequestHandlerFactory.class,
                ComponentType.REQUESTHANDLERFACTORY);
        try {
            this.reg
                    .registerComponent(DefaultRequestHandlerFactory.class, null);
            fail("RegistryException expected");
        } catch (RegistryException e) {
            //
        }
        this.reg.registerComponent(ServiceFactory.class, null);
        ServiceFactory servicefactory = this.reg.lookup(ServiceFactory.class,
                ComponentType.SERVICEFACTORY);
        assertNotNull(servicefactory);
        assertNotNull(factory);
    
public voidtestRegisterService()
Test method for 'org.apache.lucene.gdata.server.registry.FeedRegistry.registerFeed(FeedInstanceConfigurator)'

        String service = "service";
        registerService(service);
        assertEquals("Registered Configurator", this.configurator, this.reg
                .getProvidedService(service));
        assertNull("not registered Configurator", this.reg
                .getProvidedService("something"));
        try {
            this.reg.getProvidedService(null);
            fail("Exception expected");
        } catch (IllegalArgumentException e) {
            //
        }