Exemplo n.º 1
0
  @Test(
      groups = {"jaggery"},
      description = "Test for database host object")
  public void testDB() {
    ClientConnectionUtil.waitForPort(9763);

    String finalOutput = null;

    try {
      URL jaggeryURL = new URL("http://localhost:9763/testapp/database.jag");
      URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
      BufferedReader in =
          new BufferedReader(new InputStreamReader(jaggeryServerConnection.getInputStream()));

      String inputLine;
      while ((inputLine = in.readLine()) != null) {
        finalOutput = inputLine;
      }

      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      assertEquals(
          finalOutput,
          "[{\"ADDRESS\" : \"WSO2\", \"NAME\" : \"1\"},"
              + " {\"ADDRESS\" : \"59 Flower Rd\", \"NAME\" : \"2\"}]");
    }
  }
Exemplo n.º 2
0
  @Test(
      groups = {"jaggery"},
      description = "Test for database host object")
  public void testDBExist() {
    ClientConnectionUtil.waitForPort(9763);

    String finalOutput = null;

    try {
      URL jaggeryURL = new URL("http://localhost:9763/testapp/database.jag");
      URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
      BufferedReader in =
          new BufferedReader(new InputStreamReader(jaggeryServerConnection.getInputStream()));

      String inputLine;
      while ((inputLine = in.readLine()) != null) {
        finalOutput = inputLine;
      }

      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      assertNotNull(finalOutput, "Result cannot be null");
    }
  }
Exemplo n.º 3
0
  @Test(
      groups = {"jaggery"},
      description = "Test session object time operation")
  public void testSessionTimeOperation() {
    ClientConnectionUtil.waitForPort(9763);

    String finalOutput = null;

    try {
      URL jaggeryURL = new URL("http://localhost:9763/testapp/session.jag?action=timeoperation");
      URLConnection jaggeryServerConnection = jaggeryURL.openConnection();
      BufferedReader in =
          new BufferedReader(new InputStreamReader(jaggeryServerConnection.getInputStream()));

      String inputLine;
      while ((inputLine = in.readLine()) != null) {
        finalOutput = inputLine;
      }

      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      assertEquals(finalOutput, "sucess");
    }
  }
Exemplo n.º 4
0
 @BeforeClass(groups = {"wso2.is"})
 public void init() throws Exception {
   ClientConnectionUtil.waitForPort(9763);
   logger.debug("Running Passive STS Tests...");
   passiveSTSServiceStub =
       new IdentityPassiveSTSServiceStub(UserAdminConstants.PASSIVE_STS_SERVICE_URL);
   assertNotEquals(
       passiveSTSServiceStub, null, "Error in instantiation passive sts service stub.");
 }
 @BeforeClass(groups = {"wso2.cep"})
 public void login() throws Exception {
   ClientConnectionUtil.waitForPort(9443);
   String loggedInSessionCookie = util.login();
   cepAdminServiceStub =
       new CEPAdminServiceStub("https://localhost:9443/services/CEPAdminService");
   ServiceClient client = cepAdminServiceStub._getServiceClient();
   Options options = client.getOptions();
   options.setManageSession(true);
   options.setProperty(
       org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, loggedInSessionCookie);
 }
Exemplo n.º 6
0
  @Test(
      groups = {"wso2.brs"},
      enabled = true)
  public void testAddProduct() throws XMLStreamException, AxisFault {
    ClientConnectionUtil.waitForPort(9763);
    ServiceClient serviceClient = new ServiceClient();
    Options options = new Options();
    options.setTo(new EndpointReference("http://localhost:9763/services/ShoppingService"));
    options.setAction("urn:addProduct");
    serviceClient.setOptions(options);

    serviceClient.sendRobust(createAddProductPayload());
  }
Exemplo n.º 7
0
  @Test(
      groups = {"wso2.brs"},
      dependsOnMethods = {"testAddProduct"},
      enabled = false)
  public void testPurchase() throws XMLStreamException, AxisFault {
    ClientConnectionUtil.waitForPort(9763);
    ServiceClient serviceClient = new ServiceClient();
    Options options = new Options();
    options.setTo(new EndpointReference("http://localhost:9763/services/ShoppingService"));
    options.setAction("urn:purchase");
    serviceClient.setOptions(options);

    OMElement result = serviceClient.sendReceive(createPurchasePayload());
    assertNotNull(result, "Result cannot be null");
  }
 @AfterClass(groups = {"wso2.cep"})
 public void logout() throws Exception {
   ClientConnectionUtil.waitForPort(9443);
   util.logout();
 }