Testing Sling based Applications:
http://sling.apache.org/documentation/tutorials-how-tos/testing-sling-based-applications.html
Automated UI Testing
http://www.seleniumhq.org/
Monday, July 28, 2014
AEM Dev Tools for eclipse released TODAY
Just released today. The new AEM Dev Tools for Eclipse:
Need the stand-alone files if you work disconnnected?, you can get the contents here:
http://eclipse.adobe.com/aem/dev-tools/com.adobe.granite.ide.p2update-1.0.0.zip
Use this link to learn how to use it:
https://sling.apache.org/documentation/development/ide-tooling.html
The main features of this Eclipse plugin are:
- Seamless integration with AEM instances through Eclipse Server Connector.
- Synchronization for both content and OSGI bundles.
- Debugging support with code hot-swaping capability.
- Simple bootstrap of AEM projects via a specific Project Creation Wizard.
- Easy JCR properties editing.
Configuring the server, publishing changes |
Adding Nodes |
Local changes automatically published |
Setting Properties |
Wednesday, July 23, 2014
Migrating Assets Approach
I'm working on a project that requires a significant asset migration from a legacy system. I've used this approach for a few different migrations from legacy systems, and it has not failed me yet. As much as I would like to use a connector or some other easy route out of a lot of code, I didn't have a choice because the legacy software was ancient or the customer didn't want to keep both systems up.
So, the approach was to:
So, the approach was to:
- If this is a mass asset migration, turn off the workflow, "DAM Update Asset" and any other custom workflows that might interfere and cause noise.
- If you have a slave, turn it off to eliminate another variable. When you turn the slave on, it will sync.
- Ensure your aem instance is patched.
- Go into the legacy system, zip up each package of content with an associated metadata xml file
- Curl it over from the legacy system to AEM to a place under /content/dam/migrate/
- Excluded a directory from the DAM Update Asset workflow so it wouldn't create renditions of content I was about to migrate. (see my post about regular expressions)
- Create a workflow launcher that listens for zip files being created in that directory
- Execute a custom workflow model
- Created a custom workflow step that saves the path. This was needed because the payload gets destroyed in the next step.
- Executes the DAM unarchiver workflow to extract the contents, destroys the zip
- Execute a custom workflow step to process the data
- Use the path stored in step 1, use JAXB to read the data from the XML file
- Create the asset/page/etc... and add the custom data fields as needed
I've used other variations in my workflow model to DRM documents using the LiveCycle connector, executing other processes, and sending emails.
If you migrated a ton of assets, you can put the assets back into the "DAM Update Asset" workflow by using the script here:
http://www.wemblog.com/2012/09/how-to-put-dam-asset-back-to-workflow.html
If you migrated a ton of assets, you can put the assets back into the "DAM Update Asset" workflow by using the script here:
http://www.wemblog.com/2012/09/how-to-put-dam-asset-back-to-workflow.html
AEM 6 Reference materials
AEM 6 Documentation
http://docs.adobe.com/docs/en/aem/6-0.html
What's new in AEM 6?
http://cq-ops.tumblr.com/post/86504895994/whats-new-in-aem-6-0
Gems on Adobe Experience Manager - Many recorded in depth videos
http://dev.day.com/gems
AEM 6.0 and Admin Sessions
https://cqdump.wordpress.com/2014/06/23/aem-6-0-admin-sessions/
What is Sightly? (Preferred HTML templating system in AEM 6. No more JSP's!)
http://docs.adobe.com/content/docs/en/aem/6-0/develop/sightly.html
AEM 6 Hotfixes
http://helpx.adobe.com/experience-manager/kb/aem6-available-hotfixes.html
http://docs.adobe.com/docs/en/aem/6-0.html
What's new in AEM 6?
http://cq-ops.tumblr.com/post/86504895994/whats-new-in-aem-6-0
Gems on Adobe Experience Manager - Many recorded in depth videos
http://dev.day.com/gems
AEM 6.0 and Admin Sessions
https://cqdump.wordpress.com/2014/06/23/aem-6-0-admin-sessions/
What is Sightly? (Preferred HTML templating system in AEM 6. No more JSP's!)
http://docs.adobe.com/content/docs/en/aem/6-0/develop/sightly.html
AEM 6 Hotfixes
http://helpx.adobe.com/experience-manager/kb/aem6-available-hotfixes.html
RELEASED TODAY (July 28th, 2014) - The AEM Sightly Brackets Extension:
https://github.com/Adobe-Marketing-Cloud/aem-sightly-brackets-extension
Adobe Consulting Services AEM Commons
http://adobe-consulting-services.github.io/acs-aem-commons/
Adobe Consulting Services AEM Commons
http://adobe-consulting-services.github.io/acs-aem-commons/
Thursday, July 17, 2014
Another way to get an OSGI Reference
The code below will return a ResourceResolver without using an annotation. This will significantly clean up your method signatures in many cases. The only caveat to using this approach is understanding how this command will execute (currently under admin), so if you need to perform an action under a particular user, you will need to pass in additional parameters depending on what you're trying to do.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; org.osgi.framework.ServiceReference; private ResourceResolverFactory factory; ... private ResourceResolver getResolver() throws LoginException { //Get the Bundle's context BundleContext context = FrameworkUtil.getBundle(this.getClass().getBundleContext(); //Set the service reference you want ServiceReference ref = context.getServiceReference(ResourceResolverFactory.class.getName()); //Retrieve the Service factory = (ResourceResolverFactory) context.getService(ref); return factory.getAdministrativeResourceResolver(null); } ... |
Regular Expressions and Workflow Launcher Paths
An invaluable tool to configuring workflow launcher paths is regular expressions. The rules that are used to launch models uses regular expressions. I've been using www.regexr.com to test and validate my launcher paths with great success. There are a few other sites out there, but this one has worked for me.
Friday, July 11, 2014
Applying Hotfixes to CQ 5.6.1
On most projects we just patch the environments individually and create a document which lets us know which ones have been installed, i.e not checking them into github/other SCM. You should be judicious in choosing which hotfixes you install. The following link shows in bold which ones are important and I would start with just those. If you're not using a feature such as twitter, social, and others, I wouldn't install.
http://helpx.adobe.com/experience-manager/kb/cq561-available-hotfixes.html
For installing, one approach is to curl the hotfixes over with sleep statements between each statement. Be aware of hotfix 3285. For now, you need to downgrade com.adobe.granite.ui.commons-5.5.86.jar and use 5.5.77.CQ561-006.
For installing, one approach is to curl the hotfixes over with sleep statements between each statement. Be aware of hotfix 3285. For now, you need to downgrade com.adobe.granite.ui.commons-5.5.86.jar and use 5.5.77.CQ561-006.
Tuesday, July 8, 2014
Structuring Content for Faceted / QueryBuilder Searches
Tip #1 - Use the correct data types and ensure values are saved correctly. For example, if you have a date that is being saved as a string. Everything may seem fine right now, but as soon as you want to use QueryBuilder to find the content, it won't return the results you expect.
Tip #2 - Never, ever use custom data types. Use mix-ins. You've been warned.
Tip #3 - Test your content to make sure it is searchable by using the Query Builder Debugger. http://localhost:4502/libs/cq/search/content/querydebug.html
Tip #4 - Don't over complicate your data structure. For example, don't nest a bunch of nt:unstructured nodes so it makes it impossible to search the content.
Tip #5 - When you search, you typically want to sort by jcr:score. If you're not receiving the results you want, then you need to tweak the rules in your query. For example, if you want to do this at runtime, you could add, "^2" to the end of a query to property the value of a result.
QueryBuilder Predicate Operations
Exists
1_property.operation=exists
1_property=submitted
Not Exists
1_property.operation=not
1_property=submitted
Like
1_property.operation=like
1_property.value=%Apples%
1_property=jcr:title
Equals
1_property.operation=equals
1_property=jcr:title
1_property.value=Apples
Unequals (Not equals)
1_property.operation=unequals
1_property=jcr:title
1_property.value=Apples
Date Ranges
1_daterange.property=@jcr:content/jcr:created
1_daterange.lowerBound=2015-02-22
1_daterange.upperBound=2015-01-01
Skip Node Iterator Count in QueryBuilder (Save significant amount time if you have a custom authorization provider for nodes, but you don't get a count)
p.guessTotal=true
Tip #2 - Never, ever use custom data types. Use mix-ins. You've been warned.
Tip #3 - Test your content to make sure it is searchable by using the Query Builder Debugger. http://localhost:4502/libs/cq/search/content/querydebug.html
Tip #4 - Don't over complicate your data structure. For example, don't nest a bunch of nt:unstructured nodes so it makes it impossible to search the content.
Tip #5 - When you search, you typically want to sort by jcr:score. If you're not receiving the results you want, then you need to tweak the rules in your query. For example, if you want to do this at runtime, you could add, "^2" to the end of a query to property the value of a result.
QueryBuilder Predicate Operations
Exists
1_property.operation=exists
1_property=submitted
Not Exists
1_property.operation=not
1_property=submitted
1_property.operation=like
1_property.value=%Apples%
1_property=jcr:title
Equals
1_property.operation=equals
1_property=jcr:title
1_property.value=Apples
Unequals (Not equals)
1_property.operation=unequals
1_property=jcr:title
1_property.value=Apples
Date Ranges
1_daterange.property=@jcr:content/jcr:created
1_daterange.lowerBound=2015-02-22
1_daterange.upperBound=2015-01-01
Skip Node Iterator Count in QueryBuilder (Save significant amount time if you have a custom authorization provider for nodes, but you don't get a count)
p.guessTotal=true
Subscribe to:
Posts (Atom)