/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2011-2015 ForgeRock AS.
*/
/**
* A NAME does ...
*
*/
/* @formatter:off */
"{\n" +
" \"connectorsLocation\" : \"connectors\",\n" +
" \"remoteConnectorServers\" : [\n" +
" {\n" +
" \"name\" : \"testServer\",\n" +
" \"host\" : \"127.0.0.1\",\n" +
" \"_port\" : \"${openicfServerPort}\",\n" +
" \"port\" : 8759,\n" +
" \"useSSL\" : false,\n" +
" \"timeout\" : 0,\n" +
" \"key\" : \"Passw0rd\",\n" +
" \"heartbeatInterval\" : 5\n" +
" }\n" +
" ]\n" +
"}";
/* @formatter:on */
/**
* Setup logging for the {@link OpenICFProvisionerServiceTest}.
*/
.getLogger(OpenICFProvisionerServiceTest.class);
};
public OpenICFProvisionerServiceTest() {
try {
try {
.toString();
}
} catch (UnsupportedEncodingException e) {
/* ignore */
}
}
return null;
}
});
} catch (IllegalStateException e) {
/* ignore */
}
}
// ----- Implementation of RouterRegistry interface
return new RouteEntry() {
public boolean removeRoute() {
}
};
}
}
}
return new Object[][]{
{"groovy"},
{"groovyremote"}
};
}
// Start OpenICF Connector Server
connectorServer = new ConnectorServerImpl();
}
});
}
// No Connectors were found!
// Start ConnectorInfoProvider Service
// mocking
// stubbing
}
});
assertThat(configJsons).isNotNull().overridingErrorMessage("You must copy the configurations first");
// Start OpenICFProvisionerService Service
// properties.put(ComponentConstants.COMPONENT_ID, 42);
// properties.put(ComponentConstants.COMPONENT_NAME,
// getClass().getCanonicalName());
// stubbing
service.bindRouterRegistry(this);
service.bindConnectionFactory(new IDMConnectionFactoryWrapper(Resources.newInternalConnectionFactory(router)));
//set as NullActivityLogger to be the mock logger.
// Attempt to activate the provisioner service up to 4 times, using ConnectorFacade#test to
// validate proper initialization. If the connector info manager is not be initialized, the
// test fails because the connector cannot connect to the remote server. In this test, it
// manifests as a timing issue owing to the flexibility in the provisioner service and the
// connector info provider supporting the ability for the connector server to come and go, as
// managed by the health check thread (see ConnectorInfoProviderService#initialiseRemoteManager).
// The test simply executes too fast for the health check thread to complete setup of the
// connector info manager.
try {
break;
} catch (Exception e) {
}
}
}
// bind SystemObjectSetService dependencies in closure as the bind methods
// are protected
new SystemObjectSetService() {{
bindConnectionFactory(new IDMConnectionFactoryWrapper(Resources.newInternalConnectionFactory(router)));
}
}};
}
}
}
}
}
@Test
JsonValue createdObject = connection.create(new SecurityContext(new RootContext(), "system", null ), createRequest).getContent();
// Test replace operation
// Test increment operation
// Test remove operation with no value provided
// Test remove operation with value provided that is wrong
// Test remove operation with value provided
// Test add operation
// clean up by deleting this user
}
@Test
// Add another email into the array
assertThat(patchResult.get(new JsonPointer("/email/1")).asString()).isEqualTo(name + "@example2.com");
// clean up by deleting this user
}
@Test
// Add another email into the array
assertThat(patchResult.get(new JsonPointer("/email/1")).asString()).isEqualTo(name + "@example2.com");
// remove a value that doesn't exist in existing value from the array
// assert that the value was not changed
// removing from array giving explicit value,
// remove using json pointer with no value
// clean up by deleting this user
}
// Test remove attribute that doesn't exist in the target system
try {
} finally {
// clean up by deleting this user
}
}
// Test to make sure that value types can't mismatch
try {
} finally {
// clean up by deleting this user
}
}
// Try to remove the lastname that is required
try {
} finally {
// clean up by deleting this user
}
}
}
return createAttributes;
}
return createAttributes;
}
public Promise<ActionResponse, ResourceException> actionInstance(Context context, ActionRequest request) {
}
public Promise<ResourceResponse, ResourceException> patchInstance(Context context, PatchRequest request) {
return new NotSupportedException().asPromise();
}
public Promise<ResourceResponse, ResourceException> readInstance(Context context, ReadRequest request) {
return new NotSupportedException().asPromise();
}
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, UpdateRequest request) {
return new NotSupportedException().asPromise();
}
}
stage);
stage);
router.removeRoute(r);
}
for (int i = 0; i < 100; i++) {
}
queryRequest.setQueryFilter(QueryFilter.<JsonPointer>startsWith(new JsonPointer("__NAME__"), "TEST"));
int pageIndex = 0;
try {
private int index = 101;
}
})).getPagedResultsCookie() != null) {
}
} catch (ResourceException e) {
fail(e.getMessage());
}
}
//Request#1
"Arthur Dent");
//Request#2
"Zaphod Beeblebrox");
//Request#3
assertThat(result.getJsonContent().get(new JsonPointer("actions/0/result")).getObject()).isEqualTo(2);
//Request#4
"Marvin");
}
}
// AlreadyExistsException -> PreconditionFailedException
@Test(dataProvider = "groovy-only", expectedExceptions = PreconditionFailedException.class, enabled = true)
CreateRequest createRequest = Requests.newCreateRequest("system/" + systemName + "/__TEST__", getTestConnectorObject("TEST1"));
}
// ConnectorIOException -> ServiceUnavailableException - Will work when new groovy script is updated
@Test(dataProvider = "groovy-only", expectedExceptions = ServiceUnavailableException.class , enabled = true)
public void testServiceUnavailableExceptionFromConnectorIOException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_CIO");
}
// OperationTimeoutException -> ServiceUnavailableException
@Test(dataProvider = "groovy-only", expectedExceptions = ServiceUnavailableException.class , enabled = true)
public void testServiceUnavailableExceptionFromOperationTimeoutException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_OT");
}
// RetryableException -> ServiceUnavailableException
@Test(dataProvider = "groovy-only", expectedExceptions = ServiceUnavailableException.class , enabled = true)
public void testServiceUnavailableExceptionFromRetryableException(String systemName) throws Exception {
CreateRequest createRequest = Requests.newCreateRequest("system/" + systemName + "/__TEST__", getTestConnectorObject("TEST4"));
}
// ConfigurationException -> InternalServerErrorException
@Test(dataProvider = "groovy-only", expectedExceptions = InternalServerErrorException.class, enabled = true)
public void testInternalServerErrorExceptionFromConfigurationException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_CE");
}
// ConnectionBrokenException -> ServiceUnavailableException
@Test(dataProvider = "groovy-only", expectedExceptions = ServiceUnavailableException.class, enabled = true)
public void testServiceUnavailableExceptionFromConnectionBrokenException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_CB");
}
// ConnectionFailedException -> ServiceUnavailableException
@Test(dataProvider = "groovy-only", expectedExceptions = ServiceUnavailableException.class, enabled = true)
public void testServiceUnavailableExceptionFromConnectionFailedException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_CF");
}
// ConnectorException -> InternalServerErrorException
@Test(dataProvider = "groovy-only", expectedExceptions = InternalServerErrorException.class, enabled = true)
public void testInternalServerErrorExceptionFromConnectorException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_C");
}
// NullPointerException -> InternalServerErrorException
@Test(dataProvider = "groovy-only", expectedExceptions = InternalServerErrorException.class, enabled = true)
public void testInternalServerErrorExceptionFromNullPointerException(String systemName) throws Exception {
DeleteRequest deleteRequest = Requests.newDeleteRequest("system/" + systemName + "/__TEST__/TESTEX_NPE");
}
// IllegalArgumentException -> InternalServerErrorException
@Test(dataProvider = "groovy-only", expectedExceptions = InternalServerErrorException.class, enabled = true)
public void testInternalServerErrorExceptionFromIllegalArgumentException(String systemName) throws Exception {
CreateRequest createRequest = Requests.newCreateRequest("system/" + systemName + "/__TEST__", getTestConnectorObject("TEST3"));
}
// ConnectorSecurityException -> InternalServerErrorException
@Test(dataProvider = "groovy-only", expectedExceptions = InternalServerErrorException.class, enabled = true)
public void testInternalServerErrorExceptionFromConnectorSecurityException(String systemName) throws Exception {
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__TEST__", "authenticate");
}
// InvalidCredentialException - > PermanentException (UNAUTHORIZED_ERROR_CODE)
public void testPermanentExceptionFromInvalidCredentialException(String systemName) throws Exception {
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__TEST__", "authenticate");
}
// InvalidPasswordException -> PermanentException (UNAUTHORIZED_ERROR_CODE)
public void testPermanentExceptionFromInvalidPasswordException(String systemName) throws Exception {
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__TEST__", "authenticate");
}
// PermissionDeniedException -> ForbiddenException
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__TEST__", "authenticate");
}
// PasswordExpiredException -> ForbiddenException
public void testForbiddenExceptionFromPasswordExpiredException(String systemName) throws Exception {
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__TEST__", "authenticate");
}
// UnknownUidException -> NotFoundException
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/__SAMPLE__", "authenticate");
}
// UnsupportedOperationException -> NotFoundException
public void testNotFoundExceptionFromUnsupportedOperationException(String systemName) throws Exception {
ActionRequest actionRequest = Requests.newActionRequest("system/" + systemName + "/Unsupported-Object", "authenticate");
}
// InvalidAttributeValueException - > BadRequestException
CreateRequest createRequest = Requests.newCreateRequest("system/" + systemName + "/__TEST__", getTestConnectorObject("TEST2"));
}
// PreconditionFailedException -> org.forgerock.json.resource.PreconditionFailedException
@Test(dataProvider = "groovy-only", expectedExceptions = PreconditionFailedException.class, enabled = true)
}
// PreconditionRequiredException -> org.forgerock.json.resource.PreconditionRequiredException
@Test(dataProvider = "groovy-only", expectedExceptions = PreconditionRequiredException.class, enabled = true)
}
// ResourceException -> org.forgerock.json.resource.ResourceException
user);
}
stage);
router.removeRoute(r);
}
return NullSyncFailureHandler.INSTANCE;
}
}