- In Eclipse Package Explorer expand src/main/amp/config/alfresco/extension/templates/webscripts to expose the web script files.
- Load the file webscript.get.js into the Eclipse editor.
- Modify the message string and save the file.
Now switch back to your browser and hit refresh. The new message will be
Note that you did not need to refresh web scripts, restart Alfresco or do anything other than reload the web page. This is one example of hot reloading.
- Load webscript.get.html.ftl into the editor. Modify the FreeMarker code in some small way.
- Save your changes.
Switch back to the browser and reload the web page.
Your changes should take effect immediately, without having to refresh web scripts or restart Alfresco.
- In the Eclipse Package Explorer expand src/test/java to locate the DemoComponentTest.java file.
- Load it into the editor.
In Package Explorer right-click the file
DemoComponentTest.java and select .
The test will run and in the Console will display "SDK Demo AMP class has been loaded". In the JUnit tab the test will show green (passed).
- Now modify one of the tests so that it will fail. For example, you could change the line assertEquals(7, childNodeCount); to assertEquals(8, childNodeCount);
Now run the test again by right clicking the file in Package Explorer and
Note the test will run again and this time fail. But you did not need to restart Alfresco. This demonstrates hot reloading of Java code.
Change the code back and re-run the test.
It will immediately show green. The code has re-run without any reloading of Alfresco! This allows for Test Driven Development with very low overhead.