Ejemplo n.º 1
0
  /**
   * Simple call to connector test() method.
   *
   * @throws Exception
   */
  @Test
  public void test310TestConnectionNegative() throws Exception {
    final String TEST_NAME = "test310TestConnectionNegative";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN

    OperationResult result = new OperationResult(TEST_NAME);

    ConnectorInstance badConnector =
        factory.createConnectorInstance(
            connectorType,
            ResourceTypeUtil.getResourceNamespace(badResourceType),
            "test connector");
    badConnector.configure(
        badResourceType.getConnectorConfiguration().asPrismContainerValue(), result);

    // WHEN

    badConnector.test(result);

    // THEN
    result.computeStatus("test failed");
    display("Test result (FAILURE EXPECTED)", result);
    AssertJUnit.assertNotNull(result);
    OperationResult connectorConnectionResult = result.getSubresults().get(1);
    AssertJUnit.assertNotNull(connectorConnectionResult);
    System.out.println(
        "Test \"connector connection\" result: "
            + connectorConnectionResult
            + " (FAILURE EXPECTED)");
    AssertJUnit.assertTrue(
        "Unexpected success of bad connector test", !connectorConnectionResult.isSuccess());
    AssertJUnit.assertTrue(!result.isSuccess());
  }
Ejemplo n.º 2
0
  @BeforeMethod
  public void initUcf() throws Exception {
    TestUtil.displayTestTile("initUcf");

    File file = new File(FILENAME_RESOURCE_OPENDJ);
    FileInputStream fis = new FileInputStream(file);

    // Resource
    PrismObject<ResourceType> resource =
        PrismTestUtil.parseObject(new File(FILENAME_RESOURCE_OPENDJ));
    resourceType = resource.asObjectable();

    // Resource: Second copy for negative test cases
    PrismObject<ResourceType> badResource =
        PrismTestUtil.parseObject(new File(FILENAME_RESOURCE_OPENDJ_BAD));
    badResourceType = badResource.asObjectable();

    // Connector
    PrismObject<ConnectorType> connector =
        PrismTestUtil.parseObject(new File(FILENAME_CONNECTOR_LDAP));
    connectorType = connector.asObjectable();

    factory = connectorFactoryIcfImpl;

    cc =
        factory.createConnectorInstance(
            connectorType, ResourceTypeUtil.getResourceNamespace(resourceType), "test connector");
    AssertJUnit.assertNotNull("Cannot create connector instance", cc);

    connectorSchema = cc.generateConnectorSchema();
    AssertJUnit.assertNotNull("Cannot generate connector schema", cc);
    display("Connector schema", connectorSchema);

    OperationResult result = new OperationResult("initUcf");
    cc.configure(resourceType.getConnectorConfiguration().asPrismContainerValue(), result);
    cc.initialize(null, null, false, result);
    // TODO: assert something

    resourceSchema = cc.fetchResourceSchema(null, result);
    display("Resource schema", resourceSchema);

    AssertJUnit.assertNotNull(resourceSchema);
  }