Skip to content

Commit

Permalink
UI5-Based Calculator
Browse files Browse the repository at this point in the history
Possibly to be used for ASE Training. Pure JavaScript application. No
Java components at all.

Import into Eclipse as maven project.

To execute jasmine tests run mvn jasmine:bdd in web project.

Change-Id: I39cf44ae9fa0f66cebe14841586c9f1b9674580f
Signed-off-by: Adrian Goerler <[email protected]>
  • Loading branch information
agoerler committed Jul 26, 2013
1 parent 6dfb65b commit d7dfe2b
Show file tree
Hide file tree
Showing 9 changed files with 681 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.classpath
.project
.settings/
target/
*.log
*/src/main/webapp/WEB-INF/lib/
*/bin
360 changes: 360 additions & 0 deletions web/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.sap.ase.ui5calculator</groupId>
<version>1.0.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>

<artifactId>com.sap.ase.ui5calculator.web</artifactId>
<packaging>war</packaging>
<name>UI5 Calculator Web Module</name>

<properties>
<js.unit.tests.dependencies.path>${project.build.directory}/js-unit-tests-dependencies</js.unit.tests.dependencies.path>
<js.unit.tests.runtime.path>${project.build.directory}/phantomjs</js.unit.tests.runtime.path>
<version.phantomjs>1.9.0</version.phantomjs>
<sap.cloud.ui5.version>1.10.3</sap.cloud.ui5.version>
<eclipse.path>C:/eclipse/juno_java_EE_SR2/eclipse</eclipse.path>
</properties>

<dependencies>
<dependency>
<groupId>com.sap.ui5</groupId>
<artifactId>commons</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sap.ui5</groupId>
<artifactId>core</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sap.ui5</groupId>
<artifactId>resource</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sap.ui5</groupId>
<artifactId>themelib_sap_ux</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>runtime</scope>
</dependency>
<!-- advanced UI5 libs
<dependency>
<groupId>com.sap.ui5.makit</groupId>
<artifactId>com.sap.ui5.makit</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.makit_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.mobile</groupId>
<artifactId>com.sap.ui5.mobile</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.mobile_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.richtexteditor</groupId>
<artifactId>com.sap.ui5.richtexteditor</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.richtexteditor_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.table</groupId>
<artifactId>com.sap.ui5.table</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.table_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.themelib_sap_goldreflection</groupId>
<artifactId>com.sap.ui5.themelib_sap_goldreflection</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.themelib_sap_goldreflection_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.themelib_sap_ux</groupId>
<artifactId>com.sap.ui5.themelib_sap_ux</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.themelib_sap_ux_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.utils</groupId>
<artifactId>com.sap.ui5.utils</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.utils_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.ux3</groupId>
<artifactId>com.sap.ui5.ux3</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.ux3_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.visualization</groupId>
<artifactId>com.sap.ui5.visualization</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.visualization_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.ui5.viz</groupId>
<artifactId>com.sap.ui5.viz</artifactId>
<version>${sap.cloud.ui5.version}</version>
<scope>system</scope>
<systemPath>${eclipse.path}/plugins/com.sap.ui5.viz_${sap.cloud.ui5.version}.jar</systemPath>
</dependency>
-->
</dependencies>

<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.4,)
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
<goal>
unpack-dependencies
</goal>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>
[1.7,)
</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>

<!-- Extract Maven dependencies for JS unit tests -->
<execution>
<id>unpack-js-unit-tests-dependencies</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<markersDirectory>${js.unit.tests.dependencies.path}</markersDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<includeGroupIds>com.sap.ui5</includeGroupIds>
<includeScope>test</includeScope>
<outputDirectory>${js.unit.tests.dependencies.path}</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>

<!-- Extract PhantomJS runtime for JS unit tests -->
<execution>
<id>extract-js-unit-tests-runtime</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<markersDirectory>${js.unit.tests.runtime.path}</markersDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<artifactItems>
<artifactItem>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-phantom-binary</artifactId>
<version>${version.phantomjs}</version>
<classifier>${phantomjs.os.classifier}</classifier>
</artifactItem>
</artifactItems>
<outputDirectory>${js.unit.tests.runtime.path}</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/src/main/webapp/WEB-INF/lib</directory>
<includes>
<include>*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<!-- Set OS-type variable used for installing phantomjs binary -->
<profile>
<id>linux</id>
<activation>
<os>
<family>unix</family>
</os>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<phantomjs.os.classifier>unix_${os.arch}</phantomjs.os.classifier>
<phantomjs.path>${js.unit.tests.runtime.path}/bin/phantomjs</phantomjs.path>
</properties>
<!-- Make PhantomJS executable so that Jasmine can use it as driver -->
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>make-phantomjs-executable</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<chmod file="${phantomjs.path}" perm="ugo+rx" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>mac</id>
<activation>
<os>
<family>mac</family>
</os>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<phantomjs.os.classifier>mac</phantomjs.os.classifier>
<phantomjs.path>${js.unit.tests.runtime.path}/bin/phantomjs</phantomjs.path>
</properties>
</profile>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<phantomjs.os.classifier>windows</phantomjs.os.classifier>
<phantomjs.path>${js.unit.tests.runtime.path}/phantomjs.exe</phantomjs.path>
</properties>
</profile>
<!-- Execute JS unit tests with Jasmine http://pivotal.github.io/jasmine/ -->
<profile>
<id>jasmine-unit-tests</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>!ldi.releaseBuild</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.2</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<jsSrcDir>${basedir}</jsSrcDir>
<jsTestSrcDir>${basedir}/src/test/js/ui5calculator</jsTestSrcDir>
<sourceIncludes>
<include>${basedir}/src/main/webapp/js/ui5calculator/**/*.js</include>
</sourceIncludes>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<webDriverCapabilities>
<phantomjs.binary.path>${phantomjs.path}</phantomjs.binary.path>
</webDriverCapabilities>
<customRunnerTemplate>${basedir}/src/test/resources/UI5SpecRunner.htmltemplate</customRunnerTemplate>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
3 changes: 3 additions & 0 deletions web/src/main/webapp/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

14 changes: 14 additions & 0 deletions web/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee">

<display-name>ui5calculator</display-name>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>
Loading

0 comments on commit d7dfe2b

Please sign in to comment.