Package com.volantis.map.agent.impl

Examples of com.volantis.map.agent.impl.DefaultMediaAgent


/**
*/
public class MediaAgentTestCase extends TestCaseAbstract {
    public void testSimpleAll() throws Exception {
        final MediaAgent agent = new DefaultMediaAgent(
            new ResourceDescriptorStoreStub(), "http://example.com/");
        final RequestStub request = new RequestStub();
        request.addInputParameter("external-id", "1234-5678-90");
        request.addOutputParameterName("outputParamName1");
        final ResponseCallbackStub responseCallback =
            new ResponseCallbackStub();
        agent.requestURL(request, responseCallback);

        Parameters outputParams = responseCallback.getParameters();
        assertFalse(outputParams.getParameterNames().hasNext());

        final Map expectedOutputParams = new HashMap();
        expectedOutputParams.put(
            "outputParamName1", "value-of-outputParamName1");
        expectedOutputParams.put(
            MediaAgent.OUTPUT_URL_PARAMETER_NAME,
            "http://example.com/" + "1234-5678-90");
        expectedOutputParams.put(
            "an-extra-output-parameter", "value-of-the-extra-param");

        agent.waitForComplete();
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }
View Full Code Here


        agent.waitForComplete();
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }

    public void testSimpleSingle() throws Exception {
        final MediaAgent agent = new DefaultMediaAgent(
            new ResourceDescriptorStoreStub(), "http://example.com/");
        final RequestStub request = new RequestStub();
        request.addInputParameter("external-id", "1234-5678-90");
        request.addOutputParameterName("outputParamName1");
        final ResponseCallbackStub responseCallback =
            new ResponseCallbackStub();
        final AgentRequestId requestId =
            agent.requestURL(request, responseCallback);

        Parameters outputParams = responseCallback.getParameters();
        assertFalse(outputParams.getParameterNames().hasNext());

        final Map expectedOutputParams = new HashMap();
        expectedOutputParams.put(
            "outputParamName1", "value-of-outputParamName1");
        expectedOutputParams.put(
            MediaAgent.OUTPUT_URL_PARAMETER_NAME,
            "http://example.com/" + "1234-5678-90");
        expectedOutputParams.put(
            "an-extra-output-parameter", "value-of-the-extra-param");

        agent.waitForComplete(requestId);
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }
View Full Code Here

        agent.waitForComplete(requestId);
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }

    public void testSimpleSet() throws Exception {
        final MediaAgent agent = new DefaultMediaAgent(
            new ResourceDescriptorStoreStub(), "http://example.com/");
        final RequestStub request = new RequestStub();
        request.addInputParameter("external-id", "1234-5678-90");
        request.addOutputParameterName("outputParamName1");
        final ResponseCallbackStub responseCallback =
            new ResponseCallbackStub();
        final AgentRequestId requestId =
            agent.requestURL(request, responseCallback);

        Parameters outputParams = responseCallback.getParameters();
        assertFalse(outputParams.getParameterNames().hasNext());

        final Map expectedOutputParams = new HashMap();
        expectedOutputParams.put(
            "outputParamName1", "value-of-outputParamName1");
        expectedOutputParams.put(
            MediaAgent.OUTPUT_URL_PARAMETER_NAME,
            "http://example.com/" + "1234-5678-90");
        expectedOutputParams.put(
            "an-extra-output-parameter", "value-of-the-extra-param");

        agent.waitForComplete(Collections.singleton(requestId));
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }
View Full Code Here

        agent.waitForComplete(Collections.singleton(requestId));
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
    }

    public void testMultipleCall() throws Exception {
        final MediaAgent agent = new DefaultMediaAgent(
            new ResourceDescriptorStoreStub(), "http://example.com/");
        final RequestStub request = new RequestStub();
        request.addInputParameter("external-id", "1234-5678-90");
        request.addOutputParameterName("outputParamName1");
        final ResponseCallbackStub responseCallback =
            new ResponseCallbackStub();
        final AgentRequestId requestId =
            agent.requestURL(request, responseCallback);

        Parameters outputParams = responseCallback.getParameters();
        assertFalse(outputParams.getParameterNames().hasNext());

        final Map expectedOutputParams = new HashMap();
        expectedOutputParams.put(
            "outputParamName1", "value-of-outputParamName1");
        expectedOutputParams.put(
            MediaAgent.OUTPUT_URL_PARAMETER_NAME,
            "http://example.com/" + "1234-5678-90");
        expectedOutputParams.put(
            "an-extra-output-parameter", "value-of-the-extra-param");

        agent.waitForComplete(requestId);
        checkExpectedOutputParameters(responseCallback, expectedOutputParams);
        responseCallback.failOnExecute(true);
        agent.waitForComplete(requestId);
    }
View Full Code Here

TOP

Related Classes of com.volantis.map.agent.impl.DefaultMediaAgent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.