Browse Source

AMBARI-7549. Modify pom.xml for ambari-web so that it runs unit tests upon running "mvn test".(jaimin)

Jaimin Jetly 10 years ago
parent
commit
0f7dcba116
2 changed files with 38 additions and 37 deletions
  1. 25 22
      ambari-web/package.json
  2. 13 15
      ambari-web/pom.xml

+ 25 - 22
ambari-web/package.json

@@ -1,29 +1,25 @@
 {
-  "name":"Ambari",
-  "description":"Front-end package for the Apache Ambari Project",
-  "version":"1.0.0",
-  "homepage":"",
-  "repository":{
-    "type":"git",
-    "url":""
+  "name": "Ambari",
+  "description": "Front-end package for the Apache Ambari Project",
+  "version": "1.7.0",
+  "homepage": "http://ambari.apache.org/",
+  "repository": {
+    "type": "git",
+    "url": "https://git-wip-us.apache.org/repos/asf/ambari/repo?p=ambari.git;a=summary"
   },
-  "engines":{
-    "node":"~0.6.10 || 0.8 || 0.9 || 0.10"
+  "dependencies": {
+    "javascript-brunch": ">= 1.0 < 1.5",
+    "css-brunch": ">= 1.0 < 1.5",
+    "uglify-js-brunch": ">= 1.0 < 1.5",
+    "clean-css-brunch": ">= 1.0 < 1.5",
+    "ember-precompiler-brunch": ">= 1.0 < 1.5",
+    "less-brunch": ">= 1.0 < 1.5",
+    "cssstyle": "0.2.3"
   },
-  "scripts":{
-    "start":"brunch watch --server"
-  },
-  "dependencies":{
-    "javascript-brunch":">= 1.0 < 1.5",
-    "css-brunch":">= 1.0 < 1.5",
-    "uglify-js-brunch":">= 1.0 < 1.5",
-    "clean-css-brunch":">= 1.0 < 1.5",
-    "ember-precompiler-brunch":">= 1.0 < 1.5",
-    "less-brunch":">= 1.0 < 1.5",
-    "cssstyle":"0.2.3"
-  },
-  "devDependencies":{
+  "devDependencies": {
+    "phantomjs": "^1.9.2",
     "mocha":"1.9.0",
+    "mocha-phantomjs": "^3.1.6",
     "chai":"~1.9.0",
     "sinon":"=1.7.3",
     "sinon-chai":"~2.5.0",
@@ -36,5 +32,12 @@
     "karma-coverage": "~0.2.0",
     "karma-commonjs-require": "~0.0.1",
     "karma-ember-precompiler-brunch": "~0.0.1"
+  },
+  "scripts": {
+    "start": "brunch watch --server",
+    "test": "node_modules/mocha-phantomjs/bin/mocha-phantomjs public/test/test.html"
+  },
+  "engines": {
+    "node": "~0.6.10 || 0.8 || 0.9 || 0.10"
   }
 }

+ 13 - 15
ambari-web/pom.xml

@@ -23,7 +23,6 @@
     <relativePath>../ambari-project</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.ambari</groupId>
   <artifactId>ambari-web</artifactId>
   <packaging>pom</packaging>
   <name>Ambari Web</name>
@@ -139,12 +138,6 @@
                   <arg value="${basedir}/toggle-experimental.sh"/>
                   <arg value="${enableExperimental}"/>
                 </exec>
-                <exec dir="${basedir}" executable="gzip" failonerror="true">
-                  <arg value="-f"/>
-                  <arg value="public/javascripts/app.js"/>
-                  <arg value="public/javascripts/vendor.js"/>
-                  <arg value="public/stylesheets/app.css"/>
-                </exec>
               </target>
             </configuration>
           </execution>
@@ -155,23 +148,28 @@
               <goal>run</goal>
             </goals>
             <configuration>
-              <target name="ambari-web-test">
+              <target name="ambari-web unit tests" unless="${skipTests}">
+                <exec dir="${basedir}" executable="npm" failonerror="true">
+                  <env key="PYTHON" value="${basedir}/../ambari-common/src/main/unix/ambari-python-wrap" />
+                  <arg value="test"/>
+                </exec>
               </target>
             </configuration>
           </execution>
           <execution>
-            <id>package</id>
-            <phase>package</phase>
+            <id>gzip amabri-web content</id>
+            <phase>prepare-package</phase>
             <goals>
               <goal>run</goal>
             </goals>
             <configuration>
               <target name="ambari-web-package">
-                <!--
-                <copy toDir="${project.build.directory}/ambari-server-${project.version}-dist/ambari-server-${project.version}/web/">
-                  <fileset dir="${basedir}/../ambari-web/public"/>
-                </copy>
-                -->
+                <exec dir="${basedir}" executable="gzip" failonerror="true">
+                  <arg value="-f"/>
+                  <arg value="public/javascripts/app.js"/>
+                  <arg value="public/javascripts/vendor.js"/>
+                  <arg value="public/stylesheets/app.css"/>
+                </exec>
               </target>
             </configuration>
           </execution>