FileDocCategorySizeDatePackage
HessianSkeletonProviderImplTest.javaAPI DocApache Lucene 2.1.04314Wed Feb 14 10:46:00 GMT 2007org.apache.lucene.gdata.hivemind.webservice

HessianSkeletonProviderImplTest

public class HessianSkeletonProviderImplTest extends TestCase
author
Simon Willnauer

Fields Summary
HessianSkeletonProviderImpl
provider
org.easymock.MockControl
mockControl
HttpServletRequest
mockedRequest
static String
mapKey
static String
testPathSuccess
static String
testPathFail
private Map
mapping
Constructors Summary
Methods Summary
protected voidsetUp()


         
        this.mockControl = MockControl.createControl(HttpServletRequest.class);
        this.mockedRequest = this.mockControl.getMock();
        this.provider = new HessianSkeletonProviderImpl();
        this.mapping = new HashMap<String, WebserviceMappingBean>();
        WebserviceMappingBean bean = new WebserviceMappingBean();

        bean.setServiceImpl(new TestService());
        bean.setServiceInterface(Serializable.class);
        this.mapping.put(mapKey, bean);
        this.provider.setMapping(this.mapping);

    
protected voidtearDown()

        super.tearDown();
    
public voidtestGetMappingFromPath()

        try {
            this.provider.getMappingFromPath(testPathFail);
            fail("Service should not be found");
        } catch (NoSuchServiceException e) {
            //
        }

        HessianSkeleton retVal = this.provider
                .getMappingFromPath(testPathSuccess);
        assertNotNull(retVal);
        HessianSkeleton retVal1 = this.provider
                .getMappingFromPath(testPathSuccess + "/");
        assertEquals(retVal, retVal1);
        assertNotNull(retVal);
        assertEquals(Serializable.class.getName(), retVal.getAPIClassName());

    
public voidtestGetServiceSkeletonInvoker()

        this.mockControl.expectAndDefaultReturn(this.mockedRequest
                .getPathInfo(), testPathSuccess);
        this.mockControl.replay();
        assertNotNull(this.provider
                .getServiceSkeletonInvoker(this.mockedRequest));
        this.mockControl.verify();
        this.mockControl.reset();

        this.mockControl.expectAndDefaultReturn(this.mockedRequest
                .getPathInfo(), testPathFail);
        this.mockControl.replay();
        try {
            assertNotNull(this.provider
                    .getServiceSkeletonInvoker(this.mockedRequest));
            fail("Service should not be found");
        } catch (NoSuchServiceException e) {
            //
        }
        this.mockControl.verify();
        this.mockControl.reset();
    
public voidtestVerifyInterfaceImpl()

        this.mapping.get(mapKey).setServiceImpl(new WebserviceMappingBean());
        try {
            this.provider.getMappingFromPath(testPathSuccess);
            fail("Impl is not assignable to Interface");
        } catch (RuntimeException e) {
            //
        }