Skip to content

Commit

Permalink
Fixed repo tests and some compilation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 12, 2017
1 parent 794dc66 commit fe63973
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 54 deletions.
Expand Up @@ -119,14 +119,21 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="createTimestamp" type="xsd:dateTime">
<xsd:element name="stageNumber" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Number of the stage this work item is part of.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="createTimestamp" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
When was this work item created?
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="deadline" type="xsd:dateTime">
<xsd:element name="deadline" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
When is this work to be done? May be moved via escalation(s).
Expand Down Expand Up @@ -180,13 +187,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="stageNumber" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Number of the stage this work item is part of.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="escalationLevel" type="tns:WorkItemEscalationLevelType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Expand Up @@ -529,7 +529,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="start" type="xsd:dateTime" minOccurs="0">
<xsd:element name="startTimestamp" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
When this stage has started.
Expand All @@ -543,7 +543,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="end" type="xsd:dateTime" minOccurs="0">
<xsd:element name="endTimestamp" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
When this stage has actually finished.
Expand Down
Expand Up @@ -195,7 +195,7 @@ <F extends FocusType> List<ItemDelta<?,?>> getDeltasToCreateCases(
AccessCertificationCampaignType.class, prismContext);
for (AccessCertificationCaseType _case : caseList) {
_case.setStageNumber(1);
_case.setCurrentStageCreateTimestamp(stage.getStart());
_case.setCurrentStageCreateTimestamp(stage.getStartTimestamp());
_case.setCurrentStageDeadline(stage.getDeadline());

List<ObjectReferenceType> reviewers = reviewersHelper.getReviewersForCase(_case, campaign, reviewerSpec, task, result);
Expand Down Expand Up @@ -255,7 +255,7 @@ List<ItemDelta<?,?>> getDeltasToAdvanceCases(AccessCertificationCampaignType cam
AccessCertificationResponseType overallOutcome = computationHelper.computeOverallOutcome(_case, campaign, currentOutcome);
rv.addAll(DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext)
.item(F_CASE, caseId, F_WORK_ITEM).add(PrismContainerValue.toPcvList(workItems))
.item(F_CASE, caseId, F_CURRENT_STAGE_CREATE_TIMESTAMP).replace(stage.getStart())
.item(F_CASE, caseId, F_CURRENT_STAGE_CREATE_TIMESTAMP).replace(stage.getStartTimestamp())
.item(F_CASE, caseId, F_CURRENT_STAGE_DEADLINE).replace(stage.getDeadline())
.item(F_CASE, caseId, F_CURRENT_STAGE_OUTCOME).replace(OutcomeUtils.toUri(currentOutcome))
.item(F_CASE, caseId, F_OUTCOME).replace(OutcomeUtils.toUri(overallOutcome))
Expand Down
12 changes: 6 additions & 6 deletions model/model-intest/src/test/resources/security/campaigns.xml
Expand Up @@ -36,15 +36,15 @@
<defaultReviewerRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></defaultReviewerRef>
</reviewerSpecification>
</stageDefinition>
<start>2015-12-04T00:38:03.031+01:00</start>
<startTimestamp>2015-12-04T00:38:03.031+01:00</startTimestamp>
<state>inReviewStage</state>
<stageNumber>1</stageNumber>
<stage>
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<start>2015-12-04T00:38:00.708+01:00</start>
<end>2015-12-18T23:59:59.999+01:00</end>
<startTimestamp>2015-12-04T00:38:00.708+01:00</startTimestamp>
<endTimestamp>2015-12-18T23:59:59.999+01:00</endTimestamp>
</stage>
<case xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="1"
Expand Down Expand Up @@ -86,15 +86,15 @@
<defaultReviewerRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></defaultReviewerRef>
</reviewerSpecification>
</stageDefinition>
<start>2015-12-04T00:38:03.031+01:00</start>
<startTimestamp>2015-12-04T00:38:03.031+01:00</startTimestamp>
<state>inReviewStage</state>
<stageNumber>1</stageNumber>
<stage>
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<start>2015-12-04T00:38:00.708+01:00</start>
<end>2015-12-18T23:59:59.999+01:00</end>
<startTimestamp>2015-12-04T00:38:00.708+01:00</startTimestamp>
<endTimestamp>2015-12-18T23:59:59.999+01:00</endTimestamp>
</stage>
<case xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="2"
Expand Down
Expand Up @@ -47,9 +47,6 @@ public class SimpleCampaignStageNotifier extends GeneralNotifier {

private static final Trace LOGGER = TraceManager.getTrace(SimpleCampaignStageNotifier.class);

@Autowired
private MidpointFunctions midpointFunctions;

@Autowired
private CertHelper certHelper;

Expand Down Expand Up @@ -108,7 +105,7 @@ protected String getBody(Event event, GeneralNotifierType generalNotifierType, S
body.append("\n\nTime: ").append(new Date()); // the event is generated in the real time
AccessCertificationStageType stage = CertCampaignTypeUtil.getCurrentStage(campaign);
if (stage != null) {
body.append("\n\nStage start time: ").append(XmlTypeConverter.toDate(stage.getStart()));
body.append("\n\nStage start time: ").append(XmlTypeConverter.toDate(stage.getStartTimestamp()));
body.append("\nStage deadline time: ").append(XmlTypeConverter.toDate(stage.getDeadline()));
if (csEvent.isModify() && stage.getDeadline() != null) {
long delta = XmlTypeConverter.toMillis(stage.getDeadline()) - System.currentTimeMillis();
Expand Down
Expand Up @@ -109,7 +109,7 @@ protected String getBody(Event event, GeneralNotifierType generalNotifierType, S
body.append("\n\n");
AccessCertificationStageType stage = CertCampaignTypeUtil.getCurrentStage(campaign);
if (stage != null) {
body.append("Stage start time: ").append(XmlTypeConverter.toDate(stage.getStart()));
body.append("Stage start time: ").append(XmlTypeConverter.toDate(stage.getStartTimestamp()));
body.append("\nStage deadline: ").append(XmlTypeConverter.toDate(stage.getDeadline()));
if (stage.getDeadline() != null) {
long delta = XmlTypeConverter.toMillis(stage.getDeadline()) - System.currentTimeMillis();
Expand Down
Expand Up @@ -150,7 +150,7 @@ public void test210ModifyCaseProperties() throws Exception {

List<ItemDelta<?,?>> modifications = new ArrayList<>();
ItemPath case1 = new ItemPath(F_CASE).subPath(new IdItemPathSegment(1L));
modifications.add(createModificationReplaceProperty(case1.subPath(F_CURRENT_STAGE_OUTCOME), campaignDef, DELEGATE));
modifications.add(createModificationReplaceProperty(case1.subPath(F_CURRENT_STAGE_OUTCOME), campaignDef, SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE));
modifications.add(createModificationReplaceProperty(case1.subPath(AccessCertificationCaseType.F_STAGE_NUMBER), campaignDef, 300));

executeAndCheckModification(modifications, result, 0);
Expand Down Expand Up @@ -179,7 +179,7 @@ public void test230ModifyAllLevels() throws Exception {
List<ItemDelta<?,?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext)
.item(F_NAME).replace(new PolyString("Campaign 2", "campaign 2"))
.item(F_STATE).replace(IN_REMEDIATION)
.item(F_CASE, 2, F_CURRENT_STAGE_OUTCOME).replace(NO_RESPONSE)
.item(F_CASE, 2, F_CURRENT_STAGE_OUTCOME).replace(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NO_RESPONSE)
.item(F_CASE, 2, AccessCertificationCaseType.F_STAGE_NUMBER).replace(400)
.item(F_CASE, 1, F_WORK_ITEM, 1, F_OUTPUT).replace(
new AbstractWorkItemOutputType()
Expand Down
Expand Up @@ -2981,9 +2981,9 @@ public void test735QueryCertCaseReviewerAndEnabled() throws Exception {
" a2.type = :type\n" +
" ) and\n" +
" (\n" +
" a.currentStageNumber = o.stageNumber or\n" +
" a.stageNumber = o.stageNumber or\n" +
" (\n" +
" a.currentStageNumber is null and\n" +
" a.stageNumber is null and\n" +
" o.stageNumber is null\n" +
" )\n" +
" )\n" +
Expand Down Expand Up @@ -3023,9 +3023,9 @@ public void test745QueryCertCaseReviewerAndEnabledByDeadlineAndOidAsc() throws E
" a2.type = :type\n" +
" ) and\n" +
" (\n" +
" a.currentStageNumber = o.stageNumber or\n" +
" a.stageNumber = o.stageNumber or\n" +
" (\n" +
" a.currentStageNumber is null and\n" +
" a.stageNumber is null and\n" +
" o.stageNumber is null\n" +
" )\n" +
" )\n" +
Expand Down Expand Up @@ -3100,9 +3100,9 @@ public void test747QueryCertCaseReviewerAndEnabledByRequestedDesc() throws Excep
" a2.type = :type\n" +
" ) and\n" +
" (\n" +
" a.currentStageNumber = o.stageNumber or\n" +
" a.stageNumber = o.stageNumber or\n" +
" (\n" +
" a.currentStageNumber is null and\n" +
" a.stageNumber is null and\n" +
" o.stageNumber is null\n" +
" )\n" +
" ) and\n" +
Expand Down Expand Up @@ -3448,10 +3448,10 @@ public void test920DecisionsNotAnswered() throws Exception {
+ " a2.relation in (:relation)\n"
+ " ) and\n"
+ " (\n"
+ " w.stageNumber = a.currentStageNumber or\n"
+ " w.stageNumber = a.stageNumber or\n"
+ " (\n"
+ " w.stageNumber is null and\n"
+ " a.currentStageNumber is null\n"
+ " a.stageNumber is null\n"
+ " )\n"
+ " ) and\n"
+ " w.outcome is null\n"
Expand Down Expand Up @@ -3495,10 +3495,10 @@ public void test925DecisionsNotAnsweredOrderBy() throws Exception {
+ " a2.relation in (:relation)\n"
+ " ) and\n"
+ " (\n"
+ " w.stageNumber = a.currentStageNumber or\n"
+ " w.stageNumber = a.stageNumber or\n"
+ " (\n"
+ " w.stageNumber is null and\n"
+ " a.currentStageNumber is null\n"
+ " a.stageNumber is null\n"
+ " )\n"
+ " ) and\n"
+ " w.outcome is null\n"
Expand Down
6 changes: 3 additions & 3 deletions repo/repo-sql-impl-test/src/test/resources/basic/objects.xml
Expand Up @@ -1405,15 +1405,15 @@
<defaultReviewerRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></defaultReviewerRef>
</reviewerSpecification>
</stageDefinition>
<start>2015-12-04T00:38:03.031+01:00</start>
<startTimestamp>2015-12-04T00:38:03.031+01:00</startTimestamp>
<state>inReviewStage</state>
<stageNumber>1</stageNumber>
<stage id="8">
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<start>2015-12-04T00:38:00.708+01:00</start>
<end>2015-12-18T23:59:59.999+01:00</end>
<startTimestamp>2015-12-04T00:38:00.708+01:00</startTimestamp>
<endTimestamp>2015-12-18T23:59:59.999+01:00</endTimestamp>
</stage>
<case xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="1"
Expand Down
Expand Up @@ -61,15 +61,15 @@
type="c:UserType"><!-- administrator --></defaultReviewerRef>
</reviewerSpecification>
</stageDefinition>
<start>2015-12-04T00:38:03.031+01:00</start>
<startTimestamp>2015-12-04T00:38:03.031+01:00</startTimestamp>
<state>inReviewStage</state>
<stageNumber>1</stageNumber>
<stage>
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<start>2015-12-04T00:38:00.708+01:00</start>
<end>2015-12-18T23:59:59.999+01:00</end>
<startTimestamp>2015-12-04T00:38:00.708+01:00</startTimestamp>
<endTimestamp>2015-12-18T23:59:59.999+01:00</endTimestamp>
</stage>
<case xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="1"
Expand Down
Expand Up @@ -41,15 +41,15 @@
type="c:UserType"><!-- administrator --></defaultReviewerRef>
</reviewerSpecification>
</stageDefinition>
<start>2015-12-04T00:38:03.031+01:00</start>
<startTimestamp>2015-12-04T00:38:03.031+01:00</startTimestamp>
<state>inReviewStage</state>
<stageNumber>1</stageNumber>
<stage>
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<start>2015-12-04T00:38:00.708+01:00</start>
<end>2015-12-18T23:59:59.999+01:00</end>
<startTimestamp>2015-12-04T00:38:00.708+01:00</startTimestamp>
<endTimestamp>2015-12-18T23:59:59.999+01:00</endTimestamp>
</stage>
<case xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="1"
Expand Down
Expand Up @@ -89,7 +89,7 @@ public class RAccessCertificationCase implements Container<RAccessCertificationC
private XMLGregorianCalendar reviewDeadline;
private XMLGregorianCalendar remediedTimestamp;
private String currentStageOutcome;
private Integer currentStageNumber;
private Integer stageNumber;
private String outcome;

public RAccessCertificationCase() {
Expand Down Expand Up @@ -174,8 +174,8 @@ public String getCurrentStageOutcome() {
return currentStageOutcome;
}

public Integer getCurrentStageNumber() {
return currentStageNumber;
public Integer getStageNumber() {
return stageNumber;
}

public String getOutcome() {
Expand Down Expand Up @@ -233,8 +233,8 @@ public void setCurrentStageOutcome(String currentStageOutcome) {
this.currentStageOutcome = currentStageOutcome;
}

public void setCurrentStageNumber(Integer currentStageNumber) {
this.currentStageNumber = currentStageNumber;
public void setStageNumber(Integer stageNumber) {
this.stageNumber = stageNumber;
}

public void setOutcome(String outcome) {
Expand Down Expand Up @@ -271,14 +271,14 @@ public boolean equals(Object o) {
Objects.equals(reviewDeadline, that.reviewDeadline) &&
Objects.equals(remediedTimestamp, that.remediedTimestamp) &&
currentStageOutcome == that.currentStageOutcome &&
Objects.equals(currentStageNumber, that.currentStageNumber) &&
Objects.equals(stageNumber, that.stageNumber) &&
Objects.equals(outcome, that.outcome);
}

@Override
public int hashCode() {
return Objects.hash(fullObject, ownerOid, id, workItems, objectRef, targetRef, tenantRef, orgRef, activation,
reviewRequestedTimestamp, reviewDeadline, remediedTimestamp, currentStageOutcome, currentStageNumber,
reviewRequestedTimestamp, reviewDeadline, remediedTimestamp, currentStageOutcome, stageNumber,
outcome);
}

Expand Down Expand Up @@ -338,7 +338,7 @@ private static RAccessCertificationCase toRepo(RAccessCertificationCase rCase, A
rCase.setReviewDeadline(case1.getCurrentStageDeadline());
rCase.setRemediedTimestamp(case1.getRemediedTimestamp());
rCase.setCurrentStageOutcome(case1.getCurrentStageOutcome());
rCase.setCurrentStageNumber(case1.getStageNumber());
rCase.setStageNumber(case1.getStageNumber());
rCase.setOutcome(case1.getOutcome());
PrismContainerValue<AccessCertificationCaseType> cvalue = case1.asPrismContainerValue();
String xml;
Expand Down
Expand Up @@ -246,7 +246,7 @@ Restriction findAndCreateRestrictionInternal(T filter, InterpretationContext con
ProperDataSearchResult<JpaPropertyDefinition> propDefRes = resolver.findProperDataDefinition(baseEntityDefinition, path, definition, JpaPropertyDefinition.class,
context.getPrismContext());
if (propDefRes == null) {
throw new QueryException("Couldn't find a proper restriction for a ValueFilter: " + valFilter.debugDump());
throw new QueryException("Couldn't find a proper data item to query, given base entity " + baseEntityDefinition + " and this filter: " + valFilter.debugDump());
}
// TODO can't be unified?
if (propDefRes.getTargetDefinition() instanceof JpaAnyPropertyDefinition) {
Expand Down

0 comments on commit fe63973

Please sign in to comment.