Ejemplo n.º 1
0
        public void mustRenderRequestSubmittedWindow()
        {
            USSDApplication app     = getTestApp1();
            USSDRequest     request = app.newRequest("1234");

            fillRequest(request);

            USSDResponse response = BantU.executeRequest(getTestApp1(), request);

            Assert.AreEqual("operations", response.getWindow().getId());
            Assert.AreEqual(ResponseType.FORM, response.getResponseType());
            request = app.newRequest("1");
            fillRequest(request);

            response = BantU.executeRequest(getTestApp1(), request);
            Assert.AreEqual("transfers", response.getWindow().getId());
            Assert.AreEqual(ResponseType.FORM, response.getResponseType());
            request = app.newRequest("2");
            fillRequest(request);

            response = BantU.executeRequest(getTestApp1(), request);
            Assert.AreEqual("amountWindow", response.getWindow().getId());
            Assert.AreEqual(ResponseType.FORM, response.getResponseType());
            request = app.newRequest("1000");
            fillRequest(request);

            response = BantU.executeRequest(getTestApp1(), request);
            Assert.AreEqual("requestSubmitted", response.getWindow().getId());
            Assert.AreEqual(ResponseType.MESSAGE, response.getResponseType());
        }
Ejemplo n.º 2
0
        protected void delegateRequest(USSDRequest request, USSDSession <Object> session, USSDResponse response)
        {
            USSDResponse ussdResponse = BantU.executeRequest(application, request, session);

            response.setWindow(ussdResponse.getWindow());
            response.setResponseType(ussdResponse.getResponseType());
            response.setSession(ussdResponse.getSession());
        }
Ejemplo n.º 3
0
        public void mustRenderOperationsWindow()
        {
            USSDRequest request = getTestApp1().newRequest("1234");

            fillRequest(request);
            USSDResponse response = BantU.executeRequest(getTestApp1(), request);

            Assert.AreEqual("operations", response.getWindow().getId());
            Assert.AreEqual(ResponseType.FORM, response.getResponseType());
        }
Ejemplo n.º 4
0
        public void mustRenderLoginWindow()
        {
            USSDRequest request = getTestApp1().newRequest(TEST_BASE_CODE);

            fillRequest(request);
            USSDResponse response = BantU.executeRequest(getTestApp1(), request);

            Assert.AreEqual("login", response.getWindow().getId());
            Assert.AreEqual(ResponseType.FORM, response.getResponseType());
        }
Ejemplo n.º 5
0
        public void mustRenderPasswordRecoverWindow()
        {
            USSDRequest request = getTestApp1().newRequest("1111");

            fillRequest(request);
            USSDApplication app      = getTestApp1();
            USSDResponse    response = BantU.executeRequest(getTestApp1(), request);

            Assert.AreEqual("recoverPassowrd", response.getWindow().getId());
            Assert.AreEqual(ResponseType.MESSAGE, response.getResponseType());
        }
Ejemplo n.º 6
0
        public void windowFilterMustBeInvoked()
        {
            USSDApplication app    = new BaseUSSDApplication();
            Window          window = new Window("startup");

            window.addMessage(new Message("Welcome, please type something"));
            window.setInput(new Input {
                Name = "something"
            });
            app.addWindowFilter(window.getId(), new StartupWindowFirstFilter());
            app.addWindowFilter(window.getId(), new StartupWindowSecondFilter());

            app.addWindow(window);
            app.setStartupWindowId(window.getId());

            USSDRequest request = app.newRequest(TEST_BASE_CODE);

            fillRequest(request);
            USSDResponse response = BantU.executeRequest(app, request);

            Assert.AreEqual("Altered by the second filter", response.getWindow().getMessages()[0]);
        }
Ejemplo n.º 7
0
 public void doFilter(USSDRequest request, USSDSession <Object> session, USSDResponse response, USSDFilteringChain chain)
 {
     chain.proceed(request, session, response);
     response.getWindow().getMessages()[0].setContent("Altered by the second filter");
 }