Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/bin/

buildOrig.xml
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TravisExercise</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: java
jdk: oraclejdk7

script: ant test
100 changes: 87 additions & 13 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,91 @@
<?xml version="1.0"?>

<project name="DiscountStrategy" default="compile">
<property name="blddir" location="build" />
<property name="classdir" location="${blddir}/classes" />

<target name="init">
<mkdir dir="${blddir}" />
<mkdir dir="${classdir}" />
</target>

<target name="compile" depends="init">
<javac
srcdir="src"
destdir="${classdir}" />
</target>


<property name="junit.output.dir" value="junit"/>
<property environment="env"/>
<property name="libraries" value="lib"/>

<property name="srcdir" location="src/discount"/>
<property name="blddir" location="build" />
<property name="classdir" location="${blddir}" />
<property name="jardir" value="${blddir}/jar" />

<path id="JUnit 4.libraryclasspath">
<pathelement location="${libraries}/org.junit_4.11.0.v201303080030/junit.jar"/>
<pathelement location="${libraries}/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<path id="TravisExercise.classpath">
<pathelement location="${blddir}"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>


<target name="clean">
<delete dir="${blddir}"/>
</target>


<target name="init" depends="clean">
<mkdir dir="${blddir}" />
<mkdir dir="${classdir}" />
</target>


<target name="compile" depends="init">
<javac destdir="${classdir}" >
<src path="src"/>
<classpath refid="TravisExercise.classpath"/>
</javac>
</target>


<target name="link" depends="compile">
<mkdir dir="${jardir}"/>
<jar destfile="${jardir}/DiscountStrategy.jar" basedir="${classdir}">
<manifest>
<attribute name="Main-Class" value="discount.Demo" />
</manifest>
</jar>
</target>


<target name="runjar" depends="link">
<java jar="${jardir}/DiscountStrategy.jar" fork="true">
<arg value="1"/>
<arg value="100"/>
</java>
</target>


<target name="run" depends="compile">
<java classname="discount.Demo" fork="true">
<classpath>
<path location="${classdir}" />
</classpath>
<arg value="1"/>
<arg value="100"/>
</java>
</target>


<target name="test" depends="compile">
<mkdir dir="${junit.output.dir}"/>
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="test.OrderTestRandomDiscount" todir="${junit.output.dir}"/>
<test name="test.OrderTestPercentDiscount" todir="${junit.output.dir}"/>
<test name="test.OrderTestStoreCreditDiscount" todir="${junit.output.dir}"/>
<classpath refid="TravisExercise.classpath"/>
</junit>
<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.output.dir}"/>
</junitreport>
</target>


</project>
Binary file added build/discount/Demo.class
Binary file not shown.
Binary file added build/discount/DiscountStrategy.class
Binary file not shown.
Binary file added build/discount/Order.class
Binary file not shown.
Binary file added build/discount/PercentDiscountStrategy.class
Binary file not shown.
Binary file added build/discount/RandomDiscountStrategy.class
Binary file not shown.
Binary file added build/discount/StoreCreditDiscountStrategy.class
Binary file not shown.
Binary file added build/test/OrderTestPercentDiscount.class
Binary file not shown.
Binary file added build/test/OrderTestRandomDiscount.class
Binary file not shown.
Binary file added build/test/OrderTestStoreCreditDiscount.class
Binary file not shown.
82 changes: 82 additions & 0 deletions buildOrig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0"?>

<project name="DiscountStrategy" default="compile">

<property name="source.dir" value="src" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="jar.dir" value="${build.dir}/jar" />

<property name="junit.output.dir" value="junit"/>
<property environment="env"/>
<property name="libraries" value="lib"/>

<path id="JUnit 4.libraryclasspath">
<pathelement location="${libraries}/org.junit_4.11.0.v201303080030/junit.jar"/>
<pathelement location="${libraries}/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<path id="TravisExercise.classpath">
<pathelement location="bin"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>

<target name="clean">
<delete dir="${blddir}"/>
</target>

<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
</target>

<target name="compile" depends="init">
<javac srcdir="${source.dir}" destdir="${classes.dir}" />
</target>

<target name="link" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/DiscountStrategy.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="Demo" />
</manifest>
</jar>
</target>

<target name="runjar" depends="link">
<java jar="${jar.dir}/DiscountStrategy.jar" fork="true">
<arg value="2"/>
<arg value="100"/>
</java>
</target>

<target name="run" depends="compile">
<java classname="Demo" fork="true">
<classpath>
<path location="${classes.dir}" />
</classpath>
<arg value="1"/>
<arg value="100"/>
</java>
</target>


<target name="test">
<mkdir dir="${junit.output.dir}"/>
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="test.OrderTest" todir="${junit.output.dir}"/>
<classpath refid="TravisExercise.classpath"/>
</junit>

<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.output.dir}"/>
</junitreport>
</target>


</project>


144 changes: 144 additions & 0 deletions junit/TEST-test.OrderTestPercentDiscount.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="2" hostname="Aperture" name="test.OrderTestPercentDiscount" skipped="0" tests="11" time="0.056" timestamp="2015-11-19T04:44:41">
<properties>
<property name="java.vendor" value="Oracle Corporation" />
<property name="env.USERDOMAIN_ROAMINGPROFILE" value="Aperture" />
<property name="sun.java.launcher" value="SUN_STANDARD" />
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers" />
<property name="env.PROMPT" value="$P$G" />
<property name="os.name" value="Windows 8.1" />
<property name="env.FP_NO_HOST_CHECK" value="NO" />
<property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.8.0_45\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_45\jre\classes" />
<property name="env.COMPUTERNAME" value="APERTURE" />
<property name="env.CommonProgramW6432" value="C:\Program Files\Common Files" />
<property name="env.ALLUSERSPROFILE" value="C:\ProgramData" />
<property name="sun.desktop" value="windows" />
<property name="java.vm.specification.vendor" value="Oracle Corporation" />
<property name="ant.home" value="C:\Program Files\apache-ant-1.9.6\bin\.." />
<property name="java.runtime.version" value="1.8.0_45-b14" />
<property name="env.HOMEPATH" value="\Users\Demetrios" />
<property name="user.name" value="Demetrios" />
<property name="user.language" value="en" />
<property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.8.0_45\jre\bin" />
<property name="ant.project.default-target" value="compile" />
<property name="srcdir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\src\discount" />
<property name="ant.project.name" value="DiscountStrategy" />
<property name="java.version" value="1.8.0_45" />
<property name="env.PROCESSOR_IDENTIFIER" value="Intel64 Family 6 Model 58 Stepping 9, GenuineIntel" />
<property name="user.timezone" value="America/New_York" />
<property name="env.TEMP" value="C:\Users\DEMETR~1\AppData\Local\Temp" />
<property name="sun.arch.data.model" value="64" />
<property name="libraries" value="lib" />
<property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.8.0_45\jre\lib\endorsed" />
<property name="env._JAVACMD" value="java.exe" />
<property name="sun.cpu.isalist" value="amd64" />
<property name="env.HOMEDRIVE" value="C:" />
<property name="sun.jnu.encoding" value="Cp1252" />
<property name="file.encoding.pkg" value="sun.io" />
<property name="file.separator" value="\" />
<property name="java.specification.name" value="Java Platform API Specification" />
<property name="java.class.version" value="52.0" />
<property name="user.country" value="CA" />
<property name="java.home" value="C:\Program Files\Java\jdk1.8.0_45\jre" />
<property name="env.PSModulePath" value="C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\" />
<property name="env.APPDATA" value="C:\Users\Demetrios\AppData\Roaming" />
<property name="env.PUBLIC" value="C:\Users\Public" />
<property name="java.vm.info" value="mixed mode" />
<property name="env.ComSpec" value="C:\WINDOWS\system32\cmd.exe" />
<property name="env.OS" value="Windows_NT" />
<property name="env.CommonProgramFiles" value="C:\Program Files\Common Files" />
<property name="ant.file" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build.xml" />
<property name="os.version" value="6.3" />
<property name="env.=ExitCode" value="00000001" />
<property name="env.ProgramW6432" value="C:\Program Files" />
<property name="env._USE_CLASSPATH" value="no" />
<property name="path.separator" value=";" />
<property name="jardir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build/jar" />
<property name="java.vm.version" value="25.45-b02" />
<property name="user.variant" value="" />
<property name="env.USERPROFILE" value="C:\Users\Demetrios" />
<property name="ant.library.dir" value="C:\Program Files\apache-ant-1.9.6\lib" />
<property name="junit.output.dir" value="junit" />
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob" />
<property name="env.TMP" value="C:\Users\DEMETR~1\AppData\Local\Temp" />
<property name="ant.file.DiscountStrategy" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build.xml" />
<property name="sun.io.unicode.encoding" value="UnicodeLittle" />
<property name="awt.toolkit" value="sun.awt.windows.WToolkit" />
<property name="sun.stdout.encoding" value="cp437" />
<property name="user.script" value="" />
<property name="user.home" value="C:\Users\Demetrios" />
<property name="env.ProgramData" value="C:\ProgramData" />
<property name="env.SESSIONNAME" value="Console" />
<property name="env.ProgramFiles(x86)" value="C:\Program Files (x86)" />
<property name="java.specification.vendor" value="Oracle Corporation" />
<property name="classdir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build" />
<property name="java.library.path" value="C:\Program Files\Java\jdk1.8.0_45\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\apache-ant-1.9.6\bin;C:\Program Files\mingw-w64\x86_64-5.1.0-win32-seh-rt_v4-rev0\mingw64\bin;C:\Program Files\Java\jdk1.8.0_45\bin;C:\ProgramData\Oracle\Java\javapath;C:\Python27;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Calibre2\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Git\cmd;." />
<property name="env.NUMBER_OF_PROCESSORS" value="4" />
<property name="java.vendor.url" value="http://java.oracle.com/" />
<property name="java.vm.vendor" value="Oracle Corporation" />
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment" />
<property name="ant.version" value="Apache Ant(TM) version 1.9.6 compiled on June 29 2015" />
<property name="sun.java.command" value="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner test.OrderTestPercentDiscount skipNonTests=false filtertrace=true haltOnError=false haltOnFailure=false formatter=org.apache.tools.ant.taskdefs.optional.junit.OutErrSummaryJUnitResultFormatter showoutput=false outputtoformatters=true logfailedtests=true threadid=0 logtestlistenerevents=false formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,C:\Users\Demetrios\Documents\GitHub\TravisExercise\junit\TEST-test.OrderTestPercentDiscount.xml crashfile=C:\Users\Demetrios\Documents\GitHub\TravisExercise\junitvmwatcher1383688932152904767.properties propsfile=C:\Users\Demetrios\Documents\GitHub\TravisExercise\junit5256639599612805362.properties" />
<property name="java.class.path" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build;C:\Users\Demetrios\Documents\GitHub\TravisExercise\lib\org.junit_4.11.0.v201303080030\junit.jar;C:\Users\Demetrios\Documents\GitHub\TravisExercise\lib\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Program Files\apache-ant-1.9.6\lib\ant-launcher.jar;C:\Program Files\apache-ant-1.9.6\lib\ant.jar;C:\Program Files\apache-ant-1.9.6\lib\ant-junit.jar;C:\Program Files\apache-ant-1.9.6\lib\ant-junit4.jar" />
<property name="java.vm.specification.name" value="Java Virtual Machine Specification" />
<property name="ant.file.type" value="file" />
<property name="env.LOGONSERVER" value="\\APERTURE" />
<property name="env.windir" value="C:\WINDOWS" />
<property name="java.vm.specification.version" value="1.8" />
<property name="env.PROCESSOR_ARCHITECTURE" value="AMD64" />
<property name="sun.os.patch.level" value="" />
<property name="sun.cpu.endian" value="little" />
<property name="env.ProgramFiles" value="C:\Program Files" />
<property name="env.ANT_HOME" value="C:\Program Files\apache-ant-1.9.6\bin\.." />
<property name="env.PROCESSOR_REVISION" value="3a09" />
<property name="java.io.tmpdir" value="C:\Users\DEMETR~1\AppData\Local\Temp\" />
<property name="env.CommonProgramFiles(x86)" value="C:\Program Files (x86)\Common Files" />
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/" />
<property name="blddir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise\build" />
<property name="env.SystemRoot" value="C:\WINDOWS" />
<property name="ant.file.type.DiscountStrategy" value="file" />
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment" />
<property name="os.arch" value="amd64" />
<property name="env.ANT_CMD_LINE_ARGS" value=" test" />
<property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext" />
<property name="env.LOCALAPPDATA" value="C:\Users\Demetrios\AppData\Local" />
<property name="user.dir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise" />
<property name="line.separator" value="&#xd;&#xa;" />
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM" />
<property name="env.PATHEXT" value=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" />
<property name="env.Path" value="C:\Program Files\apache-ant-1.9.6\bin;C:\Program Files\mingw-w64\x86_64-5.1.0-win32-seh-rt_v4-rev0\mingw64\bin;C:\Program Files\Java\jdk1.8.0_45\bin;C:\ProgramData\Oracle\Java\javapath;C:\Python27;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Calibre2\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Git\cmd" />
<property name="basedir" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise" />
<property name="ant.java.version" value="1.8" />
<property name="ant.core.lib" value="C:\Program Files\apache-ant-1.9.6\lib\ant.jar" />
<property name="env.USERNAME" value="Demetrios" />
<property name="env.SystemDrive" value="C:" />
<property name="file.encoding" value="Cp1252" />
<property name="sun.stderr.encoding" value="cp437" />
<property name="env.USERDOMAIN" value="Aperture" />
<property name="java.specification.version" value="1.8" />
<property name="env.=C:" value="C:\Users\Demetrios\Documents\GitHub\TravisExercise" />
<property name="ant.project.invoked-targets" value="test" />
<property name="env.PROCESSOR_LEVEL" value="6" />
</properties>
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest10" time="0.001" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest11" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest1" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest2" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest3" time="0.001" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest4" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest5" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest6" time="0.003">
<failure message="expected:&lt;444.0&gt; but was:&lt;4884.0&gt;" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: expected:&lt;444.0&gt; but was:&lt;4884.0&gt;
at test.OrderTestPercentDiscount.percentageDiscountTest6(Unknown Source)
</failure>
</testcase>
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest7" time="0.0">
<failure message="expected:&lt;0.0&gt; but was:&lt;-3996.0&gt;" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: expected:&lt;0.0&gt; but was:&lt;-3996.0&gt;
at test.OrderTestPercentDiscount.percentageDiscountTest7(Unknown Source)
</failure>
</testcase>
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest8" time="0.0" />
<testcase classname="test.OrderTestPercentDiscount" name="percentageDiscountTest9" time="0.0" />
<system-out><![CDATA[]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
Loading