Skip to content

Commit

Permalink
Fixing intests
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jul 9, 2018
1 parent 4641f70 commit c8da3cf
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
Expand Up @@ -28,6 +28,7 @@
import com.evolveum.midpoint.schema.SearchResultList;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.internals.InternalCounters;
import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition;
import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand Down Expand Up @@ -168,6 +169,8 @@ public void test100AddGroupShadowSwashbucklers() throws Exception {
assertEquals("Wrong group description", GROUP_DUMMY_SWASHBUCKLERS_DESCRIPTION,
dummyGroup.getAttributeValue(DummyResourceContoller.DUMMY_GROUP_ATTRIBUTE_DESCRIPTION));

// First use of the resource
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
assertSteadyResources();
}

Expand Down Expand Up @@ -394,6 +397,8 @@ public void test300AddRoleWimp() throws Exception {
display("Group @orange", dummyGroupAtOrange);
assertNoGroupMembers(dummyGroupAtOrange);

// First use of the resource
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
assertSteadyResources();
}

Expand Down
Expand Up @@ -215,6 +215,8 @@ public void test100ModifyUserAddAccount() throws Exception {
+ "\n"
+ "Channel: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user", addMessage.getBody());

// First use of the resource
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
assertSteadyResources();
}

Expand Down
Expand Up @@ -57,6 +57,7 @@
import com.evolveum.midpoint.schema.RetrieveOption;
import com.evolveum.midpoint.schema.SearchResultList;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.internals.InternalCounters;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.MiscSchemaUtil;
import com.evolveum.midpoint.task.api.Task;
Expand Down Expand Up @@ -1226,6 +1227,7 @@ public void validate(PrismPropertyDefinition<String> propDef, String name) throw
});

assertUntouchedUserDefinition();
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
assertSteadyResources();
}

Expand Down
Expand Up @@ -41,6 +41,7 @@
import com.evolveum.midpoint.schema.PointInTimeType;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.internals.InternalCounters;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.Trace;
Expand Down Expand Up @@ -156,6 +157,25 @@ protected OperationResultStatusType getExpectedResultStatus(PendingOperationExec
return null;
}

@Test
@Override
public void test100AssignWillRoleOne() throws Exception {
// The count will be checked only after propagation was run, so we can address both direct and grouping cases
rememberCounter(InternalCounters.CONNECTOR_MODIFICATION_COUNT);

assignWillRoleOne("test100AssignWillRoleOne", USER_WILL_FULL_NAME, PendingOperationExecutionStatusType.EXECUTION_PENDING);

// No counter increment asserted here. Connector instance is initialized in propagation. Not yet.
assertSteadyResources();
}

@Override
protected void assertTest103Counters() {
super.assertTest103Counters();
// First use of the resoruce
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
}

/**
* disable - do not run propagation yet
* (do not wait for delta to expire, we want several deltas at once so we can test grouping).
Expand Down
Expand Up @@ -695,7 +695,11 @@ public void test099TestConnection() throws Exception {
public void test100AssignWillRoleOne() throws Exception {
// The count will be checked only after propagation was run, so we can address both direct and grouping cases
rememberCounter(InternalCounters.CONNECTOR_MODIFICATION_COUNT);

assignWillRoleOne("test100AssignWillRoleOne", USER_WILL_FULL_NAME, PendingOperationExecutionStatusType.EXECUTION_PENDING);

assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 1);
assertSteadyResources();
}

@Test
Expand Down Expand Up @@ -774,14 +778,18 @@ public void test103RunPropagation() throws Exception {
displayThen(TEST_NAME);
assertSuccess(result);

// The count is checked only after propagation was run, so we can address both direct and grouping cases
assertCounterIncrement(InternalCounters.CONNECTOR_MODIFICATION_COUNT, 1);
assertTest103Counters();

assertAccountWillAfterAssign(TEST_NAME, USER_WILL_FULL_NAME, PendingOperationExecutionStatusType.EXECUTING);

assertSteadyResources();
}

protected void assertTest103Counters() {
// The count is checked only after propagation was run, so we can address both direct and grouping cases
assertCounterIncrement(InternalCounters.CONNECTOR_MODIFICATION_COUNT, 1);
}

@Test
public void test104RecomputeWill() throws Exception {
final String TEST_NAME = "test104RecomputeWill";
Expand Down Expand Up @@ -2080,8 +2088,6 @@ protected void assignWillRoleOne(final String TEST_NAME, String expectedFullName
accountWillReqestTimestampEnd = clock.currentTimeXMLGregorianCalendar();

assertAccountWillAfterAssign(TEST_NAME, expectedFullName, executionStage);

assertSteadyResources();
}

protected void assertAccountWillAfterAssign(final String TEST_NAME, String expectedFullName, PendingOperationExecutionStatusType executionStage) throws Exception {
Expand Down
Expand Up @@ -30,8 +30,10 @@
import org.w3c.dom.Element;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.internals.InternalCounters;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationExecutionStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

Expand Down Expand Up @@ -89,5 +91,5 @@ protected File getPropagationTaskFile() {
protected void assertResourceSchemaBeforeTest(Element resourceXsdSchemaElementBefore) {
AssertJUnit.assertNotNull("No schema before test connection. Bad test setup?", resourceXsdSchemaElementBefore);
}

}

0 comments on commit c8da3cf

Please sign in to comment.