/*
   * adding an invalid wsdl (a normal .xml) no assertions and tear down
   * because wsdl addition wouldn't happen
   */
  @Test(
      groups = "wso2.greg",
      description = "Add Invalid WSDL",
      expectedExceptions = GovernanceException.class)
  public void testInvalidAdditionWSDL()
      throws RemoteException, ResourceAdminServiceExceptionException, GovernanceException,
          MalformedURLException {

    WsdlManager wsdlManager = new WsdlManager(governanceRegistry);
    Wsdl wsdl =
        wsdlManager.newWsdl(
            "https://svn.wso2.org/repos/wso2/carbon/platform/trunk/"
                + "platform-integration/clarity-tests/org.wso2.carbon.automation.test.repo/"
                + "src/main/resources/artifacts/GREG/wsdl/AutomatedInvalidWSDL.wsdl");
    wsdl.addAttribute("version", "1.0.0");
    wsdl.addAttribute("author", "Aparna");
    wsdl.addAttribute("description", "added invalid wsdl using url");
    wsdlManager.addWsdl(wsdl);
  }
  /** adding a encoded URL wsdl */
  @Test(groups = "wso2.greg", description = "Add Encoded WSDL")
  public void testAddEncodedURLWSDL()
      throws RemoteException, ResourceAdminServiceExceptionException, GovernanceException,
          MalformedURLException {

    wsdl =
        wsdlManager.newWsdl(
            "https://raw.githubusercontent.com/wso2/wso2-qa-artifacts/master/automation-artifacts/greg"
                + "/wsdl/StockQuote.wsdl");

    wsdl.addAttribute("version", "1.0.0");
    wsdl.addAttribute("author", "Aparna");
    wsdl.addAttribute("description", "added encoded url wsdl");
    wsdlManager.addWsdl(wsdl);
    assertFalse(wsdl.getId().isEmpty());
    assertNotNull(wsdl);
    assertTrue(wsdl.getAttribute("author").contentEquals("Aparna")); // encoded url wsdl
    // addition verification
  }
  /** adding an valid wsdl with corrupted policies: exception verified via expectedExceptions */
  @Test(
      groups = "wso2.greg",
      description = "Add valid wsdl with corrupted policies",
      expectedExceptions = GovernanceException.class)
  public void testAddValidWSDLWithCorruptedPolicies()
      throws RemoteException, GovernanceException, MalformedURLException {

    WsdlManager wsdlManager = new WsdlManager(governanceRegistry);

    Wsdl wsdl =
        wsdlManager.newWsdl(
            "https://svn.wso2.org/repos/wso2/carbon/platform/trunk/platform-integration/"
                + "platform-automated-test-suite/org.wso2.carbon.automation.test.repo/src/main/resources/artifacts/"
                + "GREG/wsdl/wsdlWithCorruptedPolicy.wsdl");

    wsdl.addAttribute("version", "1.0.0");
    wsdl.addAttribute("author", "Aparna");
    wsdl.addAttribute("description", "added valid wsdl with corrupted Policy via url");
    wsdlManager.addWsdl(wsdl);
  }