-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
812 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/AbstractUuidTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package com.evolveum.midpoint.testing.story.uuid; | ||
/* | ||
* Copyright (c) 2014-2019 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.PrismReferenceValue; | ||
import com.evolveum.midpoint.prism.util.PrismTestUtil; | ||
import com.evolveum.midpoint.schema.constants.MidPointConstants; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.test.IntegrationTestTools; | ||
import com.evolveum.midpoint.test.util.MidPointTestConstants; | ||
import com.evolveum.midpoint.test.util.TestUtil; | ||
import com.evolveum.midpoint.testing.story.AbstractStoryTest; | ||
import com.evolveum.midpoint.util.exception.*; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.*; | ||
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; | ||
import org.opends.server.types.DirectoryException; | ||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.annotation.DirtiesContext.ClassMode; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.testng.AssertJUnit; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.Listeners; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.testng.AssertJUnit.assertEquals; | ||
|
||
/** | ||
* @author Radovan Semancik | ||
* | ||
*/ | ||
@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) | ||
@DirtiesContext(classMode = ClassMode.AFTER_CLASS) | ||
@Listeners({ com.evolveum.midpoint.tools.testng.AlphabeticalMethodInterceptor.class }) | ||
public abstract class AbstractUuidTest extends AbstractStoryTest { | ||
|
||
public static final File TEST_DIR = new File(MidPointTestConstants.TEST_RESOURCES_DIR, "uuid"); | ||
|
||
public static final File OBJECT_TEMPLATE_USER_FILE = new File(TEST_DIR, "object-template-user.xml"); | ||
public static final String OBJECT_TEMPLATE_USER_OID = "10000000-0000-0000-0000-000000000222"; | ||
|
||
protected static final String RESOURCE_OPENDJ_OID = "10000000-0000-0000-0000-000000000003"; | ||
protected static final String RESOURCE_OPENDJ_NAMESPACE = MidPointConstants.NS_RI; | ||
|
||
protected static final String ATTR_ROOM_NUMBER = "roomNumber"; | ||
protected static final String ATTR_MOBILE = "mobile"; | ||
protected static final String ATTR_DEPARTMENT_NUMBER = "departmentNumber"; | ||
|
||
protected ResourceType resourceOpenDjType; | ||
protected PrismObject<ResourceType> resourceOpenDj; | ||
|
||
protected String userRappOid; | ||
protected String userMancombOid; | ||
|
||
@Override | ||
protected void startResources() throws Exception { | ||
openDJController.startCleanServer(); | ||
} | ||
|
||
@AfterClass | ||
public static void stopResources() throws Exception { | ||
openDJController.stop(); | ||
} | ||
|
||
@Override | ||
public void initSystem(Task initTask, OperationResult initResult) throws Exception { | ||
super.initSystem(initTask, initResult); | ||
|
||
// Resources | ||
resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, getResourceOpenDjFile(), RESOURCE_OPENDJ_OID, initTask, initResult); | ||
resourceOpenDjType = resourceOpenDj.asObjectable(); | ||
openDJController.setResource(resourceOpenDj); | ||
|
||
// Object Templates | ||
importObjectFromFile(OBJECT_TEMPLATE_USER_FILE, initResult); | ||
|
||
} | ||
|
||
protected abstract File getResourceOpenDjFile(); | ||
|
||
@Override | ||
protected File getSystemConfigurationFile() { | ||
return SYSTEM_CONFIGURATION_FILE; | ||
} | ||
|
||
@Test | ||
public void test000Sanity() throws Exception { | ||
final String TEST_NAME = "test000Sanity"; | ||
displayTestTitle(TEST_NAME); | ||
Task task = createTask(TEST_NAME); | ||
|
||
OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); | ||
TestUtil.assertSuccess(testResultOpenDj); | ||
|
||
waitForTaskStart(TASK_TRIGGER_SCANNER_OID, true); | ||
waitForTaskStart(TASK_VALIDITY_SCANNER_OID, true); | ||
} | ||
|
||
} |
Oops, something went wrong.