Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 12, 2018
2 parents 9449327 + 1f534b6 commit 47b595b
Show file tree
Hide file tree
Showing 21 changed files with 312 additions and 40 deletions.
18 changes: 13 additions & 5 deletions .travis.yml
Expand Up @@ -10,12 +10,20 @@ cache:

before_install:
- choco install maven
- export MAVEN_OPTS='-Xmx6g'
- RefreshEnv.cmd
- export MAVEN_OPTS='-Xmx6g -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
- export JAVA_HOME=`find "/c/Program Files/Java" -name jdk1.8.*`

# custom script is used so build and tests are done in one mvn command, separating it (as Travis does by default) leads to problem with ConnId (notably DummyResource)
script: mvn -B clean install

addons:
hostname: localhost # workaround for short hostname
hostname: localhost # workaround for short hostname

env:
global:
- MALLOC_ARENA_MAX=2

matrix:
include:
- name: JDK8 - Run all excluding model-intest
script: mvn install -B -DskipTests; mvn verify -DskipModelIntTest=true -DskipModelUnitTest=true
- name: JDK8 - Run only model-intest
script: mvn install -B -DskipTests; mvn verify -pl :model-intest
80 changes: 77 additions & 3 deletions build-system/pom.xml
Expand Up @@ -89,11 +89,11 @@
<wro4j.version>1.8.0</wro4j.version>
<jackson.version>2.9.5</jackson.version>
<snakeyaml.version>1.19</snakeyaml.version>
<surefire.version>2.22.1</surefire.version>
<surefire.version>3.0.0-M2</surefire.version>
<reflections.version>0.9.11</reflections.version>
<guava.version>20.0</guava.version>
<jcommander.version>1.72</jcommander.version>
<failsafe.version>2.22.0</failsafe.version>
<failsafe.version>3.0.0-M2</failsafe.version>
<antrun.version>1.8</antrun.version>
</properties>
<dependencyManagement>
Expand Down Expand Up @@ -1427,6 +1427,7 @@
</properties>
</configuration>
</execution>
<!--
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
Expand All @@ -1444,11 +1445,12 @@
</property>
<property>
<name>usedefaultlisteners</name>
<value>false</value> <!-- do not generate HTML to make the runs faster -->
<value>false</value>
</property>
</properties>
</configuration>
</execution>
-->
</executions>
<configuration>
<parallel>false</parallel>
Expand Down Expand Up @@ -1492,6 +1494,50 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<!--
<parallel>false</parallel>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<javax.net.ssl.trustStore>src/test/resources/truststore.jks</javax.net.ssl.trustStore>
<midpoint.home>target/midpoint-home</midpoint.home>
<java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties</java.util.logging.config.file>
</systemPropertyVariables>
<argLine>-Xms1024m -Xmx4096m -Duser.language=en</argLine>
<suiteXmlFiles>
<suiteXmlFile>testng-integration.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>suitename</name>
<value>Integration</value>
</property>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
Expand Down Expand Up @@ -1626,6 +1672,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -1641,6 +1694,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -1656,6 +1716,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -1671,6 +1738,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down
6 changes: 6 additions & 0 deletions dist/midpoint-api/pom.xml
Expand Up @@ -134,6 +134,12 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
Expand Down
Expand Up @@ -1790,6 +1790,8 @@ private MainMenuItem createServerTasksItems() {
PageTaskEdit.class, null, createVisibleDisabledBehaviorForEditMenu(PageTaskEdit.class));
item.getItems().add(menuItem);

addCollectionsMenuItems(item.getItems(), TaskType.COMPLEX_TYPE);

return item;
}

Expand All @@ -1806,6 +1808,8 @@ private MainMenuItem createResourcesItems() {
addMenuItem(item, "PageAdmin.menu.top.resources.import", PageImportResource.class);
addMenuItem(item, "PageAdmin.menu.top.connectorHosts.list", PageConnectorHosts.class);

addCollectionsMenuItems(item.getItems(), ResourceType.COMPLEX_TYPE);

return item;
}

Expand Down Expand Up @@ -1930,7 +1934,7 @@ private MainMenuItem createUsersItems() {
createFocusPageNewEditMenu(item.getItems(), "PageAdmin.menu.top.users.new",
"PageAdmin.menu.top.users.edit", PageUser.class, true);

addUsersViewMenuItems(item.getItems());
addCollectionsMenuItems(item.getItems(), UserType.COMPLEX_TYPE);

return item;
}
Expand Down Expand Up @@ -2048,6 +2052,8 @@ private MainMenuItem createOrganizationsMenu() {
createFocusPageNewEditMenu(item.getItems(), "PageAdmin.menu.top.users.org.new", "PageAdmin.menu.top.users.org.edit",
PageOrgUnit.class, true);

addCollectionsMenuItems(item.getItems(), OrgType.COMPLEX_TYPE);

return item;
}

Expand All @@ -2060,6 +2066,8 @@ private MainMenuItem createRolesItems() {
createFocusPageNewEditMenu(item.getItems(), "PageAdmin.menu.top.roles.new", "PageAdmin.menu.top.roles.edit",
PageRole.class, true);

addCollectionsMenuItems(item.getItems(), RoleType.COMPLEX_TYPE);

return item;
}

Expand All @@ -2072,11 +2080,13 @@ private MainMenuItem createServicesItems() {
createFocusPageNewEditMenu(item.getItems(), "PageAdmin.menu.top.services.new", "PageAdmin.menu.top.services.edit",
PageService.class, true);

addCollectionsMenuItems(item.getItems(), ServiceType.COMPLEX_TYPE);

return item;
}

private void addUsersViewMenuItems(List<MenuItem> menu) {
List<CompiledObjectCollectionView> objectViews = getCompiledUserProfile().findAllApplicableObjectCollectionViews(UserType.COMPLEX_TYPE);
private void addCollectionsMenuItems(List<MenuItem> menu, QName type) {
List<CompiledObjectCollectionView> objectViews = getCompiledUserProfile().findAllApplicableObjectCollectionViews(type);
if (objectViews == null) {
return;
}
Expand All @@ -2102,18 +2112,13 @@ private void addUsersViewMenuItems(List<MenuItem> menu) {
return;
}
ObjectType objectType = collectionObject.asObjectable();
if (!(objectType instanceof ObjectCollectionType)) {
return;
}

ObjectCollectionType collectionValue = (ObjectCollectionType) objectType;
if (!QNameUtil.match(collectionValue.getType(), UserType.COMPLEX_TYPE)) {
if (!(objectType instanceof ObjectCollectionType) && !(objectType instanceof ArchetypeType)) {
return;
}
DisplayType viewDisplayType = objectView.getDisplay();

PageParameters pageParameters = new PageParameters();
pageParameters.add(PageUsersView.PARAMETER_OBJECT_COLLECTION_TYPE_OID, collectionValue.getOid());
pageParameters.add(PageUsersView.PARAMETER_OBJECT_COLLECTION_TYPE_OID, objectType.getOid());

MenuItem userViewMenu = new MenuItem(viewDisplayType != null && PolyStringUtils.isNotEmpty(viewDisplayType.getLabel())
? createStringResource(viewDisplayType.getLabel())
Expand Down
Expand Up @@ -986,8 +986,8 @@ protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTar
}

ConfirmationPanel dialog = new ConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(),
createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmation",
"pageContentAccounts.message.deleteConfirmationSingle")) {
createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmationSingle",
"pageContentAccounts.message.deleteConfirmation")) {
@Override
public void yesPerformed(AjaxRequestTarget target) {
deleteAccountConfirmedPerformed(target, result, selectedShadow);
Expand Down
Expand Up @@ -80,12 +80,16 @@ public class PageAssignmentsList<F extends FocusType> extends PageBase{
private IModel<List<AssignmentEditorDto>> assignmentsModel;
private OperationResult backgroundTaskOperationResult = null;
IModel<String> descriptionModel;
private boolean conflictProblemExists = false;
private boolean loadConflicts = false;


public PageAssignmentsList(){
this(false);
}

public PageAssignmentsList(boolean loadConflicts){
this.loadConflicts = loadConflicts;
initModels();
if (loadConflicts){
getSessionStorage().getRoleCatalog().setConflictsList(getAssignmentConflicts());
Expand Down Expand Up @@ -155,14 +159,13 @@ protected String getUserButtonLabel(){
protected void onDeleteSelectedUsersPerformed(AjaxRequestTarget target){
super.onDeleteSelectedUsersPerformed(target);
getSessionStorage().getRoleCatalog().setTargetUserList(new ArrayList<>());

target.add(getTargetUserSelectionButton());
targetUserChangePerformed(target);
}

@Override
protected void multipleUsersSelectionPerformed(AjaxRequestTarget target, List<UserType> usersList){
getSessionStorage().getRoleCatalog().setTargetUserList(usersList);
target.add(getTargetUserSelectionButton());
targetUserChangePerformed(target);
}

};
Expand Down Expand Up @@ -215,6 +218,7 @@ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
public boolean isEnabled(){
return (getSessionStorage().getRoleCatalog().isMultiUserRequest() ||
onlyWarnings() || areConflictsResolved()) &&
!conflictProblemExists &&
getSessionStorage().getRoleCatalog().getAssignmentShoppingCart() != null &&
getSessionStorage().getRoleCatalog().getAssignmentShoppingCart().size() > 0;
}
Expand Down Expand Up @@ -286,6 +290,15 @@ private void onSingleUserRequestPerformed(AjaxRequestTarget target) {
}
}

private void targetUserChangePerformed(AjaxRequestTarget target){
PageAssignmentsList.this.getFeedbackMessages().clear();
conflictProblemExists = false;
if (loadConflicts){
getSessionStorage().getRoleCatalog().setConflictsList(getAssignmentConflicts());
}
target.add(PageAssignmentsList.this);
}

@NotNull
private ModelExecuteOptions createOptions() {
OperationBusinessContextType businessContextType;
Expand Down Expand Up @@ -449,17 +462,22 @@ private List<ConflictDto> getAssignmentConflicts(){
.previewChanges(WebComponentUtil.createDeltaCollection(delta), recomputeOptions, task, result);
DeltaSetTriple<? extends EvaluatedAssignment> evaluatedAssignmentTriple = modelContext
.getEvaluatedAssignmentTriple();
Collection<? extends EvaluatedAssignment> addedAssignments = evaluatedAssignmentTriple.getPlusSet();
for (EvaluatedAssignment<UserType> evaluatedAssignment : addedAssignments) {

for (EvaluatedPolicyRule policyRule : evaluatedAssignment.getAllTargetsPolicyRules()) {
if (!policyRule.containsEnabledAction()) {
continue;
if (evaluatedAssignmentTriple != null) {
Collection<? extends EvaluatedAssignment> addedAssignments = evaluatedAssignmentTriple.getPlusSet();
for (EvaluatedAssignment<UserType> evaluatedAssignment : addedAssignments) {
for (EvaluatedPolicyRule policyRule : evaluatedAssignment.getAllTargetsPolicyRules()) {
if (!policyRule.containsEnabledAction()) {
continue;
}
// everything other than 'enforce' is a warning
boolean isWarning = !policyRule.containsEnabledAction(EnforcementPolicyActionType.class);
fillInConflictedObjects(evaluatedAssignment, policyRule.getAllTriggers(), isWarning, conflictsMap);
}
// everything other than 'enforce' is a warning
boolean isWarning = !policyRule.containsEnabledAction(EnforcementPolicyActionType.class);
fillInConflictedObjects(evaluatedAssignment, policyRule.getAllTriggers(), isWarning, conflictsMap);
}
} else if (!result.isSuccess() && StringUtils.isNotEmpty(getSubresultWarningMessages(result))) {
getFeedbackMessages().warn(PageAssignmentsList.this,
createStringResource("PageAssignmentsList.conflictsWarning").getString() + " " + getSubresultWarningMessages(result));
conflictProblemExists = true;
}
} catch (Exception e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get assignments conflicts. Reason: ", e);
Expand All @@ -468,6 +486,20 @@ private List<ConflictDto> getAssignmentConflicts(){
conflictsList.addAll(conflictsMap.values());
return conflictsList;
}

private String getSubresultWarningMessages(OperationResult result){
if (result == null || result.getSubresults() == null){
return "";
}
StringBuilder sb = new StringBuilder();
result.getSubresults().forEach(subresult ->{
if (subresult.isWarning()){
sb.append(subresult.getMessage());
sb.append("\n");
}
});
return sb.toString();
}

private void fillInConflictedObjects(EvaluatedAssignment<UserType> evaluatedAssignment, Collection<EvaluatedPolicyRuleTrigger<?>> triggers, boolean isWarning, Map<String, ConflictDto> conflictsMap) {

Expand Down
Expand Up @@ -3901,6 +3901,7 @@ AssignmentConflictPanel.undoAction=Undo
PageAssignmentConflicts.title=Assignments conflicts
PageAssignmentConflicts.back=Back
PageAssignmentConflicts.submit=Submit
PageAssignmentsList.conflictsWarning=Unable to calculate assignment conflicts due to authorization problem. Reason:
AbstractShoppingCartTabPanel.addAllButton=Add all
AbstractShoppingCartTabPanel.requestingForLabel=Requesting for
AbstractShoppingCartTabPanel.availableRelationsLabel=Available relations
Expand Down

0 comments on commit 47b595b

Please sign in to comment.