コード例 #1
0
  @Test(groups = "wso2.greg")
  public void testAddCollections()
      throws ResourceAdminServiceExceptionException, RemoteException, XPathExpressionException {

    String fileType = "other";
    String description = "A test collection";
    resourceAdminClient.addCollection(PATH, CHILDS_CHILD_NAME, fileType, description);

    String authorUserName = resourceAdminClient.getResource(PARENT_PATH)[0].getAuthorUserName();
    assertTrue(
        automationContext
            .getContextTenant()
            .getContextUser()
            .getUserName()
            .equalsIgnoreCase(authorUserName),
        "Parent collection creation failure");

    authorUserName =
        resourceAdminClient.getResource(PARENT_PATH + CHILD_NAME)[0].getAuthorUserName();
    assertTrue(
        automationContext
            .getContextTenant()
            .getContextUser()
            .getUserName()
            .equalsIgnoreCase(authorUserName),
        "Child collection creation failure");
  }
コード例 #2
0
  @Test(dependsOnMethods = "testAddCollections")
  public void testAddResource()
      throws MalformedURLException, ResourceAdminServiceExceptionException, RemoteException,
          XPathExpressionException {

    String path =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "testresource.txt";
    DataHandler dataHandler = new DataHandler(new URL("file:///" + path));

    String fileType = "plain/text";
    resourceAdminClient.addResource(PATH + RES_NAME, fileType, RES_DESC, dataHandler);

    String authorUserName = resourceAdminClient.getResource(PATH + RES_NAME)[0].getAuthorUserName();
    assertTrue(
        automationContext
            .getContextTenant()
            .getContextUser()
            .getUserName()
            .equalsIgnoreCase(authorUserName),
        "Resource creation failure");
  }
コード例 #3
0
  @Test(groups = "wso2.greg", dependsOnMethods = "testAddDependencyFromOwnCollection")
  public void testAddWsdlAsADependency()
      throws MalformedURLException, ResourceAdminServiceExceptionException, RemoteException,
          AddAssociationRegistryExceptionException, XPathExpressionException {
    String resourcePath =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "wsdl"
            + File.separator
            + "AmazonWebServices.wsdl";
    DataHandler dh = new DataHandler(new URL("file:///" + resourcePath));
    resourceAdminClient.addResource(
        ROOT + "AmazonWebServices.wsdl", "application/wsdl+xml", "testDesc", dh);
    assertTrue(
        resourceAdminClient
            .getResource(WSDL_PATH)[0]
            .getAuthorUserName()
            .contains(automationContext.getContextTenant().getContextUser().getUserName()),
        "WSDL has not been added");

    String dependencyType = "depends";
    String todo = "add";

    relationServiceClient.addAssociation(PATH + RES_NAME, dependencyType, WSDL_PATH, todo);

    DependenciesBean bean = relationServiceClient.getDependencies(PATH + RES_NAME);
    assertTrue(
        dependencyType.equalsIgnoreCase(bean.getAssociationBeans()[0].getAssociationType()),
        "Dependency type is not correct");

    assertTrue(
        WSDL_PATH.equalsIgnoreCase(bean.getAssociationBeans()[0].getDestinationPath()),
        "Target dependency is not correct");

    assertTrue(
        (PATH + RES_NAME).equalsIgnoreCase(bean.getAssociationBeans()[0].getSourcePath()),
        "Source dependency is not correct");

    // remove dependency
    relationServiceClient.addAssociation(PATH + RES_NAME, dependencyType, WSDL_PATH, "remove");
  }
コード例 #4
0
  @Test(groups = "wso2.greg", description = "Create a service")
  public void testCreateService()
      throws XMLStreamException, IOException, AddServicesServiceRegistryExceptionException,
          ListMetadataServiceRegistryExceptionException, ResourceAdminServiceExceptionException {

    String servicePath =
        getTestArtifactLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "services"
            + File.separator
            + "intergalacticService16.metadata.xml";
    DataHandler dataHandler = new DataHandler(new URL("file:///" + servicePath));
    String mediaType = "application/vnd.wso2-service+xml";
    String description = "This is a test service";
    resourceAdminServiceClient.addResource(
        "/_system/governance/service2", mediaType, description, dataHandler);
    ResourceData[] data = resourceAdminServiceClient.getResource(absPath);
    assertNotNull(data, "Service not found");
  }
コード例 #5
0
  @Test(groups = "wso2.greg", dependsOnMethods = "testAddSchemaAsADependency")
  public void testAddRxt()
      throws MalformedURLException, ResourceAdminServiceExceptionException, RemoteException,
          XPathExpressionException {
    String resourcePath =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "rxt"
            + File.separator
            + "person.rxt";
    DataHandler dh = new DataHandler(new URL("file:///" + resourcePath));

    resourceAdminClient.addResource(RXT_LOCATION, RXT_FILE_TYPE, "TstDec", dh);

    assertTrue(
        resourceAdminClient
            .getResource(RXT_LOCATION)[0]
            .getAuthorUserName()
            .contains(automationContext.getContextTenant().getContextUser().getUserName()));
  }
コード例 #6
0
  @Test(groups = "wso2.greg", dependsOnMethods = "testAddDependencyFromChildCollection")
  public void testMoveDependency()
      throws ResourceAdminServiceExceptionException, RemoteException,
          AddAssociationRegistryExceptionException, XPathExpressionException {
    resourceAdminClient.moveResource(PATH, PATH + CHILDS_CHILD_NAME, ROOT, CHILDS_CHILD_NAME);

    String authorUserName =
        resourceAdminClient.getResource(ROOT + CHILDS_CHILD_NAME)[0].getAuthorUserName();
    assertTrue(
        automationContext
            .getContextTenant()
            .getContextUser()
            .getUserName()
            .equalsIgnoreCase(authorUserName),
        "Collection move failure");

    String dependencyType = "depends";

    DependenciesBean bean = relationServiceClient.getDependencies(PATH + RES_NAME);
    assertTrue(
        dependencyType.equalsIgnoreCase(bean.getAssociationBeans()[0].getAssociationType()),
        "Dependency type is not correct");

    assertTrue(
        (ROOT + CHILDS_CHILD_NAME)
            .equalsIgnoreCase(bean.getAssociationBeans()[0].getDestinationPath()),
        "Target dependency is not correct");

    assertTrue(
        (PATH + RES_NAME).equalsIgnoreCase(bean.getAssociationBeans()[0].getSourcePath()),
        "Source dependency is not correct");

    // remove the dependency
    relationServiceClient.addAssociation(
        PATH + RES_NAME, dependencyType, ROOT + CHILDS_CHILD_NAME, "remove");
  }