Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 5.x/testing imporvements #236

Open
wants to merge 5 commits into
base: master-5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apix-docker/70/debug-extension.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- DEBUG=true
- SHARE_HOST=alfresco-share
- GLOBAL_eu.xenit.apix.integrationtest.bootstrap=true
alfresco-share:
image: hub.xenit.eu/public/alfresco-share-community:7.0.0
ports:
Expand Down
2 changes: 1 addition & 1 deletion apix-docker/70/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
alfresco-core:
image: ${DOCKER_IMAGE}
image: ${DOCKER_IMAGE:-private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.0}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults can lead to silent failures when the image is not built. I prefer to keep them out.

ports:
- "${DOCKER_IP}:8080:8080"
volumes:
Expand Down
1 change: 1 addition & 0 deletions apix-docker/71/debug-extension.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- DEBUG=true
- SHARE_HOST=alfresco-share
- GLOBAL_eu.xenit.apix.integrationtest.bootstrap=true
alfresco-share:
image: hub.xenit.eu/public/alfresco-share-community:7.1
ports:
Expand Down
2 changes: 1 addition & 1 deletion apix-docker/71/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
alfresco-core:
image: ${DOCKER_IMAGE}
image: ${DOCKER_IMAGE:-private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.1}
ports:
- "${DOCKER_IP}:8080:8080"
volumes:
Expand Down
1 change: 1 addition & 0 deletions apix-docker/72/debug-extension.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- DEBUG=true
- SHARE_HOST=alfresco-share
- GLOBAL_eu.xenit.apix.integrationtest.bootstrap=true
alfresco-share:
image: hub.xenit.eu/public/alfresco-share-community:7.2
ports:
Expand Down
2 changes: 1 addition & 1 deletion apix-docker/72/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
alfresco-core:
image: ${DOCKER_IMAGE}
image: ${DOCKER_IMAGE:-private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.2}
ports:
- "${DOCKER_IP}:8080:8080"
volumes:
Expand Down
1 change: 1 addition & 0 deletions apix-docker/73/debug-extension.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- DEBUG=true
- SHARE_HOST=alfresco-share
- GLOBAL_eu.xenit.apix.integrationtest.bootstrap=true
alfresco-share:
image: docker.io/xenit/alfresco-share-community:7.3
ports:
Expand Down
2 changes: 1 addition & 1 deletion apix-docker/73/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
alfresco-core:
image: ${DOCKER_IMAGE}
image: ${DOCKER_IMAGE:-private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.3}
ports:
- "${DOCKER_IP}:8080:8080"
volumes:
Expand Down
1 change: 1 addition & 0 deletions apix-docker/74/debug-extension.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
environment:
- DEBUG=true
- SHARE_HOST=alfresco-share
- GLOBAL_eu.xenit.apix.integrationtest.bootstrap=true
alfresco-share:
image: docker.io/xenit/alfresco-share-community:7.4
ports:
Expand Down
2 changes: 1 addition & 1 deletion apix-docker/74/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
alfresco-core:
image: ${DOCKER_IMAGE}
image: ${DOCKER_IMAGE:-private.docker.xenit.eu/alfresco-enterprise/alfresco-repository-enterprise:7.4}
ports:
- "${DOCKER_IP}:8080:8080"
volumes:
Expand Down
1 change: 1 addition & 0 deletions apix-docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ subprojects {
alfrescoSM "com.gradecak.alfresco-mvc:alfresco-mvc-aop:${mvc}"
alfrescoSM files(jar)
alfrescoAmp "eu.xenit:alfresco-dynamic-extensions-repo-${subproject_alfresco_version}:${de_version}@amp"
alfrescoAmp "org.orderofthebee.support-tools:support-tools-repo:${ootbee_version}:amp@amp"
}

dockerCompose {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package eu.xenit.apix.bootstrap;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.nodelocator.CompanyHomeNodeLocator;
import org.alfresco.repo.nodelocator.NodeLocatorService;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Bootstrap implements InitializingBean {

public static final String WELL_KNOWN_TESTNODE_NAME = "well-known-testnode";
private static final String ENABLED_GLOBAL_PROPERTIES_KEY = "eu.xenit.apix.integrationtest.bootstrap.enabled";

private RetryingTransactionHelper transactionHelper;
private NodeLocatorService nodeLocator;
private NodeService nodeService;
private Properties globalProperties;

@Autowired
public Bootstrap(
RetryingTransactionHelper retryingTransactionHelper,
NodeLocatorService nodeLocatorService,
NodeService nodeService,
@Qualifier("global-properties") Properties globalProperties
) {
this.transactionHelper = retryingTransactionHelper;
this.nodeLocator = nodeLocatorService;
this.nodeService = nodeService;
this.globalProperties = globalProperties;
}

@Override
public void afterPropertiesSet() throws Exception {
if (Boolean.parseBoolean(globalProperties.getProperty(ENABLED_GLOBAL_PROPERTIES_KEY))) {
AuthenticationUtil.runAsSystem(
() -> transactionHelper.doInTransaction(
() -> {
NodeRef companyHome = nodeLocator.getNode(CompanyHomeNodeLocator.NAME, null, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeRef wellKnownTestNode = nodeService.getChildByName(companyHome,
ContentModel.ASSOC_CONTAINS, WELL_KNOWN_TESTNODE_NAME);
if (wellKnownTestNode == null) {
Map<QName, Serializable> folderProperties = new HashMap<>();
folderProperties.put(ContentModel.PROP_NAME, WELL_KNOWN_TESTNODE_NAME);
folderProperties.put(ContentModel.PROP_NODE_UUID, WELL_KNOWN_TESTNODE_NAME);
nodeService.createNode(
companyHome,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
WELL_KNOWN_TESTNODE_NAME),
ContentModel.TYPE_FOLDER,
folderProperties
);
}
return null;
},
false,
true
)
);
}
}
}
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins {
id 'eu.xenit.de' version '3.1.0' apply false
id 'eu.xenit.amp' version '1.1.0' apply false
id 'eu.xenit.alfresco' version '1.1.0' apply false
id 'eu.xenit.docker-alfresco' version '5.3.1' apply false
id 'eu.xenit.docker-compose' version '5.3.1' apply false
id 'eu.xenit.docker-alfresco' version '5.5.0' apply false
id 'eu.xenit.docker-compose' version '5.5.0' apply false
id 'eu.xenit.alfresco-remote-testrunner' version '2.0.1' apply false
}

Expand All @@ -23,6 +23,7 @@ ext {
jackson_version = '2.8.3'
care4alfVersion = '2.3.0'
http_version = '4.3.4' // Used by integration tests
ootbee_version = '1.2.2.0' // Used in docker image for testing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is only used once, why not keep it locally, close to where it is used? It makes development easier since there is less switching needed.

}

subprojects {
Expand Down
Loading