Review Board 1.7.22


Closure compile all feature JavaScript as part of JUnit execution to ensure no JavaScript errors at build time

Review Request #5107 - Created May 14, 2012 and submitted

Stanton Sievers
SHINDIG-1771
Reviewers
shindig
shindig
See the JIRA for the high-level description.

My approach to doing this was to introduce a new test case in the end-to-end tests.  This way I can test with a real FeatureRegistry against the real web app.  I make a request to the JsServlet for all of the features, which will run through the compiler processors.  Because of the changes that went in for https://issues.apache.org/jira/browse/SHINDIG-1770, we will return the compile error and this will get printed as part of the JUnit assert failure, pin-pointing the exact compile problem.

Note that this does increase the time it takes to execute the EndToEndTest on the scale of tens of seconds.
Introduced some JS errors and verified that the unit test failed.  Additionally verified the reason for the failure was readily available.

Changes between revision 2 and 3

1 2 3 4
1 2 3 4

  1. http://svn.apache.org/repos/asf/shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java: Loading...
http://svn.apache.org/repos/asf/shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java
Diff Revision 2 Diff Revision 3
[20] 35 lines
[+20]
36
import com.google.common.base.Joiner;
36
import com.google.common.base.Joiner;
37
import com.google.inject.Inject;
37
import com.google.inject.Inject;
38

    
   
38

   
39
public class AllJsFilter extends InjectedFilter {
39
public class AllJsFilter extends InjectedFilter {
40

    
   
40

   
41
  private FeatureRegistry registry;

   
42
  private String allFeatures;
41
  private String allFeatures;
43

    
   
42

   
44
  @Inject
43
  @Inject
45
  public void setFeatureRegistryProvider(FeatureRegistryProvider provider) {
44
  public void setFeatureRegistryProvider(FeatureRegistryProvider provider) {
46
    try {
45
    try {
47
      this.registry = provider.get(null);
46
      FeatureRegistry registry = provider.get(null);
48
      Set<String> allFeatureNames = this.registry.getAllFeatureNames();
47
      Set<String> allFeatureNames = registry.getAllFeatureNames();
49
      allFeatures = Joiner.on(':').join(allFeatureNames);
48
      allFeatures = Joiner.on(':').join(allFeatureNames);
50
    } catch (GadgetException e) {
49
    } catch (GadgetException e) {
51
      e.printStackTrace();
50
      e.printStackTrace();
52
    }
51
    }
53
  }
52
  }
[+20] [20] 24 lines
  1. http://svn.apache.org/repos/asf/shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java: Loading...