Successfully reported this slideshow.
Your SlideShare is downloading. ×

Talk @ AEM meetup hosted by Emakina Amsterdam

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Spot the bullies!
Spot the bullies!
Loading in …3
×

Check these out next

1 of 28 Ad

Talk @ AEM meetup hosted by Emakina Amsterdam

Download to read offline

Manual actions are mindnumbing for developers all over the world. On top of that, developers want to automate about everything.

AEMAdmin started out of frustration of having to delete several nodes in the repository manually after every deploy on my localbox. I wanted an error-free 1-click operation. So I defined the steps just once and let the program run over and over again.

In the meantime, it kept on growing and it now is a fullblown library with all kind of actions for property, node and page manipulations, querying, and so on. All commands follow the same structure and when testing is finished, you can point it to a different environment to execute the same tasks in the same order.

In this talk, I'll tell about the story how it came to be and how real-life challenges made the project grow. So expect a lot of live action and maybe some deja-vus.

Manual actions are mindnumbing for developers all over the world. On top of that, developers want to automate about everything.

AEMAdmin started out of frustration of having to delete several nodes in the repository manually after every deploy on my localbox. I wanted an error-free 1-click operation. So I defined the steps just once and let the program run over and over again.

In the meantime, it kept on growing and it now is a fullblown library with all kind of actions for property, node and page manipulations, querying, and so on. All commands follow the same structure and when testing is finished, you can point it to a different environment to execute the same tasks in the same order.

In this talk, I'll tell about the story how it came to be and how real-life challenges made the project grow. So expect a lot of live action and maybe some deja-vus.

Advertisement
Advertisement

More Related Content

Recently uploaded (20)

Advertisement

Talk @ AEM meetup hosted by Emakina Amsterdam

  1. 1. NO MORENO MORE MONKEYWORKMONKEYWORK WITH AEMADMINWITH AEMADMIN Pieter-Jan Drouillon AEM Developer Meetup NL - May 8, 2018
  2. 2. ABOUT MEABOUT ME Academic background Short-lived career in Supply Chain Full-stack developer @ Design Is Dead
  3. 3. WHY?WHY?
  4. 4. POINT & CLICKPOINT & CLICK 1. Update property 2. Add node 3. Install content package
  5. 5. STUMBLED ON ...STUMBLED ON ...
  6. 6. FIRST ATTEMPTFIRST ATTEMPT
  7. 7. function createPage{ param([int]$port=4502,[string]$path,[string]$name,[string] if($deleteFirst){ deletePage -port $port -path $path -name $name } $cmd = 'curl.exe -u admin:admin -F"jcr:primaryType=cq:Page Invoke-Expression $cmd $cmd = 'curl.exe -u admin:admin -F"jcr:primaryType=cq:Page Invoke-Expression $cmd }
  8. 8. PROS / CONSPROS / CONS Lightweight Testable Easy & consistent syntax
  9. 9. WHY NOT JAVA?WHY NOT JAVA?
  10. 10. TESTABLETESTABLE Junit & Mockito
  11. 11. LIGHTWEIGHTLIGHTWEIGHT Apache HttpClient, Commons Lang & com.github.tsohr:json
  12. 12. EASY & CONSISTENTEASY & CONSISTENT Naming convention & method chaining
  13. 13. EXAMPLESEXAMPLES
  14. 14. ADDING PROPERTIESADDING PROPERTIES
  15. 15. CompositeCommand cc = new CompositeCommand(); //base website String[] base_languages = {"nl","fr","en"}; String[] base_segments = {"retail","soho","sme"}; for(String lang:base_languages){ for(String segment:base_segments){ String path = String.format("/content/kpngb-base/%s/%s SetPropertyCommand spc = new SetPropertyCommand(path," cc.add(spc); path = String.format("/content/kpngb-base/%s/%s/sales- spc = new SetPropertyCommand(path,"enableOnlineSales", cc.add(spc); } }
  16. 16. QUERY COMMANDQUERY COMMAND
  17. 17. public QueryCommand addCondition(String key,String value) public QueryCommand setHitLimit(int limit) public QueryCommand fullHit() public QueryCommand propertyExists(String prefix, String propertyName) public int getResults() public int getTotal() public boolean hasMore()
  18. 18. POSTPROCESSPOSTPROCESS
  19. 19. /** * Queries return JSON with an array called hits. This method will pro * @param hit the result to process */ public abstract void postProcessOneResult(JSONObject hit);
  20. 20. DEFINE QUERYDEFINE QUERY public WorkflowInstancesQueryCommand(String status){ addCondition("path","/etc/workflow/instances/server0"); addCondition("p.hits","full"); addCondition("orderby","endTime"); if(status != null){ addCondition("1_property","status"); addCondition("1_value",status); } else{ propertyExists("1_","status"); } }
  21. 21. LOOP OVER HITSLOOP OVER HITS public class DifferentStatusValuesCommand extends QueryPostPro private Set<string> statuses; public DifferentStatusValuesCommand(WorkflowInstancesQuery super(command); statuses = new HashSet<>(); } @Override public void postProcessOneResult(JSONObject hit) { statuses.add(hit.getString("status")); } public Set<string> getStatuses() { return statuses; } }
  22. 22. INSTANCE INSTALLINSTANCE INSTALL
  23. 23. CompositeCommand cc = new CompositeCommand(); //Enable crx/de EnableCrxCommand ecc = new EnableCrxCommand(); cc.add(ecc); BulkPackageInstallCommand bpic = new BulkPackageInstallCommand //One off packages for a fresh install bpic.addPackage("D:packages_to_installacs-aem-commons-cont .addPackage("D:packages_to_installacs-aem-tools-content-0. .addPackage("D:packages_to_installAEM-6.3-Service-Pack-1-6 .addPackage("D:packages_to_installcq-6.3.0-hotfix-19148-1. .addPackage("D:packages_to_installContent_auth_PROD_CRQ000 .addPackage("D:packages_to_installContent_auth_PROD_CRQ000 .addPackage("D:packages_to_installpermissions.zip") .addPackage("D:packages_to_installnprd_userGroups.zip"); //install the Java code
  24. 24. OTHER FEATURESOTHER FEATURES
  25. 25. Instance config via cmdline property fat jar
  26. 26. CONCLUSIONCONCLUSION
  27. 27. Reduce point & click monkeywork Testable Lightweight Easy http://github.com/pieterjd/aemadmin
  28. 28. Q & AQ & A Pieter-Jan Drouillon Pieter-Jan @ designisdead.com

×