/**
   * Test fetching and translating resource schema.
   *
   * @throws Exception
   */
  @Test
  public void test400FetchResourceSchema() throws Exception {
    final String TEST_NAME = "test400FetchResourceSchema";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN

    // WHEN

    // The schema was fetched during test init. Now just check if it was OK.

    // THEN

    AssertJUnit.assertNotNull(resourceSchema);

    System.out.println(resourceSchema.debugDump());

    Document xsdSchema = resourceSchema.serializeToXsd();

    System.out.println(
        "-------------------------------------------------------------------------------------");
    System.out.println(DOMUtil.printDom(xsdSchema));
    System.out.println(
        "-------------------------------------------------------------------------------------");

    ObjectClassComplexTypeDefinition accountDefinition =
        resourceSchema.findObjectClassDefinition(
            new QName(
                ResourceTypeUtil.getResourceNamespace(resourceType),
                ProvisioningTestUtil.OBJECT_CLASS_INETORGPERSON_NAME));
    AssertJUnit.assertNotNull(accountDefinition);

    AssertJUnit.assertFalse(
        "No identifiers for account object class ", accountDefinition.getIdentifiers().isEmpty());

    PrismPropertyDefinition uidDefinition =
        accountDefinition.findAttributeDefinition(
            new QName(
                ResourceTypeUtil.getResourceNamespace(resourceType),
                ProvisioningTestUtil.RESOURCE_OPENDJ_PRIMARY_IDENTIFIER_LOCAL_NAME));
    AssertJUnit.assertNotNull(uidDefinition);

    for (Definition def : resourceSchema.getDefinitions()) {
      if (def instanceof ResourceAttributeContainerDefinition) {
        ResourceAttributeContainerDefinition rdef = (ResourceAttributeContainerDefinition) def;
        assertNotEmpty("No type name in object class", rdef.getTypeName());
        assertNotEmpty(
            "No native object class for " + rdef.getTypeName(), rdef.getNativeObjectClass());

        // This is maybe not that important, but just for a sake of
        // completeness
        assertNotEmpty("No name for " + rdef.getTypeName(), rdef.getName());
      }
    }
  }
  /**
   * Test fetching and translating resource schema.
   *
   * @throws Exception
   */
  @Test
  public void testFetchResourceSchema() throws CommunicationException, SchemaException {
    TestUtil.displayTestTile("testFetchResourceSchema");
    // GIVEN

    // WHEN

    // The schema was fetched during test init. Now just check if it was OK.

    // THEN

    AssertJUnit.assertNotNull(resourceSchema);

    System.out.println(resourceSchema.debugDump());

    Document xsdSchema = resourceSchema.serializeToXsd();

    System.out.println(
        "-------------------------------------------------------------------------------------");
    System.out.println(DOMUtil.printDom(xsdSchema));
    System.out.println(
        "-------------------------------------------------------------------------------------");

    ObjectClassComplexTypeDefinition accountDefinition =
        resourceSchema.findObjectClassDefinition(
            new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "AccountObjectClass"));
    AssertJUnit.assertNotNull(accountDefinition);

    AssertJUnit.assertFalse(
        "No identifiers for account object class ", accountDefinition.getIdentifiers().isEmpty());

    PrismPropertyDefinition uidDefinition =
        accountDefinition.findPropertyDefinition(ConnectorFactoryIcfImpl.ICFS_UID);
    AssertJUnit.assertNotNull(uidDefinition);

    for (Definition def : resourceSchema.getDefinitions()) {
      if (def instanceof ResourceAttributeContainerDefinition) {
        ResourceAttributeContainerDefinition rdef = (ResourceAttributeContainerDefinition) def;
        assertNotEmpty("No type name in object class", rdef.getTypeName());
        assertNotEmpty(
            "No native object class for " + rdef.getTypeName(), rdef.getNativeObjectClass());

        // This is maybe not that important, but just for a sake of
        // completeness
        assertNotEmpty("No name for " + rdef.getTypeName(), rdef.getName());
      }
    }
  }