Skip to content

Commit

Permalink
feat: mixet with newer template
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-sekanina committed Nov 4, 2022
1 parent 347d7f4 commit 0d26c78
Show file tree
Hide file tree
Showing 25 changed files with 1,155 additions and 948 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Typical output:
[ant:verify] INFO: Verification completed with 0 warnings and 0 errors.
```

## Installation on a card
## Installation on a (physical) card

```bash
./gradlew installJavaCard
Expand All @@ -87,6 +87,16 @@ Or inspect already installed applets:
./gradlew listJavaCard
```

## Running on simulator (jCardSim)

As simple as:

```bash
./gradlew run
```

By default the run task will run the main Java application implemented at: `main/java/main/Run.java`, using the `HelloWorldApplet` applet.

## Running tests

```
Expand Down
20 changes: 14 additions & 6 deletions applet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {

apply plugin: 'com.klinec.gradle.javacard'
apply plugin: 'idea'
apply plugin: 'application'
sourceCompatibility = 1.8

// Common settings, definitions
Expand All @@ -30,7 +31,6 @@ repositories {
// mavenLocal() // for local maven repository if needed

// Repository with JCardSim, Globalplatform, etc, ...
maven { url "https://dl.bintray.com/ph4r05/jcard" }
maven { url "https://javacard.pro/maven" }
maven { url "https://deadcode.me/mvn" }

Expand All @@ -44,11 +44,13 @@ repositories {
dependencies {
jcardsim 'com.klinec:jcardsim:3.0.5.11'

implementation 'com.klinec:jcardsim:3.0.5.11'

testImplementation 'org.testng:testng:6.1.1'
testImplementation 'org.slf4j:slf4j-api:1.7.2'
testImplementation 'org.slf4j:slf4j-log4j12:1.7.2'
testImplementation 'org.apache.logging.log4j:log4j-core:2.11.2'
testImplementation 'junit:junit:4.12'
testImplementation 'org.slf4j:slf4j-api:1.7.33'
testImplementation 'org.slf4j:slf4j-log4j12:1.7.33'
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'

Expand All @@ -72,6 +74,10 @@ task dumpClassPath(dependsOn: ['idea']) {
}
}

application {
mainClass = 'main.Run'
}

test {
// useTestNG()
useJUnitPlatform {
Expand Down Expand Up @@ -123,7 +129,9 @@ javacard {
packageName 'applet'
version '0.1'
aid '01:ff:ff:04:05:06:07:08:09'
output 'applet.cap'
output 'applet_main_applet.cap'

sources 'src/main/java/applet'

// JC310b43 supports compilation targeting for lower API versions.
// Here you can specify path to the SDK you want to use.
Expand Down
527 changes: 338 additions & 189 deletions applet/build/reports/tests/test/classes/tests.AppletTest.html

Large diffs are not rendered by default.

58 changes: 39 additions & 19 deletions applet/build/reports/tests/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ <h1>Test Summary</h1>
<tr>
<td>
<div class="infoBox" id="tests">
<div class="counter">1</div>
<div class="counter">6</div>
<p>tests</p>
</div>
</td>
<td>
<div class="infoBox" id="failures">
<div class="counter">0</div>
<div class="counter">3</div>
<p>failures</p>
</div>
</td>
Expand All @@ -38,7 +38,7 @@ <h1>Test Summary</h1>
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.171s</div>
<div class="counter">0.101s</div>
<p>duration</p>
</div>
</td>
Expand All @@ -47,8 +47,8 @@ <h1>Test Summary</h1>
</div>
</td>
<td>
<div class="infoBox success" id="successRate">
<div class="percent">100%</div>
<div class="infoBox failures" id="successRate">
<div class="percent">50%</div>
<p>successful</p>
</div>
</td>
Expand All @@ -58,13 +58,33 @@ <h1>Test Summary</h1>
<div id="tabs">
<ul class="tabLinks">
<li>
<a href="#tab0">Packages</a>
<a href="#tab0">Failed tests</a>
</li>
<li>
<a href="#tab1">Packages</a>
</li>
<li>
<a href="#tab1">Classes</a>
<a href="#tab2">Classes</a>
</li>
</ul>
<div id="tab0" class="tab">
<h2>Failed tests</h2>
<ul class="linkList">
<li>
<a href="classes/tests.AppletTest.html">AppletTest</a>.
<a href="classes/tests.AppletTest.html#transaction1()">transaction1()</a>
</li>
<li>
<a href="classes/tests.AppletTest.html">AppletTest</a>.
<a href="classes/tests.AppletTest.html#transaction2()">transaction2()</a>
</li>
<li>
<a href="classes/tests.AppletTest.html">AppletTest</a>.
<a href="classes/tests.AppletTest.html#transaction3()">transaction3()</a>
</li>
</ul>
</div>
<div id="tab1" class="tab">
<h2>Packages</h2>
<table>
<thead>
Expand All @@ -79,19 +99,19 @@ <h2>Packages</h2>
</thead>
<tbody>
<tr>
<td class="success">
<td class="failures">
<a href="packages/tests.html">tests</a>
</td>
<td>1</td>
<td>6</td>
<td>3</td>
<td>0</td>
<td>0</td>
<td>0.171s</td>
<td class="success">100%</td>
<td>0.101s</td>
<td class="failures">50%</td>
</tr>
</tbody>
</table>
</div>
<div id="tab1" class="tab">
<div id="tab2" class="tab">
<h2>Classes</h2>
<table>
<thead>
Expand All @@ -106,14 +126,14 @@ <h2>Classes</h2>
</thead>
<tbody>
<tr>
<td class="success">
<td class="failures">
<a href="classes/tests.AppletTest.html">tests.AppletTest</a>
</td>
<td>1</td>
<td>0</td>
<td>6</td>
<td>3</td>
<td>0</td>
<td>0.171s</td>
<td class="success">100%</td>
<td>0.101s</td>
<td class="failures">50%</td>
</tr>
</tbody>
</table>
Expand All @@ -126,7 +146,7 @@ <h2>Classes</h2>
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 6.6</a> at 1 Jul 2022, 4:46:09 AM</p>
<a href="http://www.gradle.org">Gradle 6.6</a> at 4 Nov 2022, 1:50:38 AM</p>
</div>
</div>
</body>
Expand Down
44 changes: 32 additions & 12 deletions applet/build/reports/tests/test/packages/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ <h1>Package tests</h1>
<tr>
<td>
<div class="infoBox" id="tests">
<div class="counter">1</div>
<div class="counter">6</div>
<p>tests</p>
</div>
</td>
<td>
<div class="infoBox" id="failures">
<div class="counter">0</div>
<div class="counter">3</div>
<p>failures</p>
</div>
</td>
Expand All @@ -40,7 +40,7 @@ <h1>Package tests</h1>
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.171s</div>
<div class="counter">0.101s</div>
<p>duration</p>
</div>
</td>
Expand All @@ -49,8 +49,8 @@ <h1>Package tests</h1>
</div>
</td>
<td>
<div class="infoBox success" id="successRate">
<div class="percent">100%</div>
<div class="infoBox failures" id="successRate">
<div class="percent">50%</div>
<p>successful</p>
</div>
</td>
Expand All @@ -60,10 +60,30 @@ <h1>Package tests</h1>
<div id="tabs">
<ul class="tabLinks">
<li>
<a href="#tab0">Classes</a>
<a href="#tab0">Failed tests</a>
</li>
<li>
<a href="#tab1">Classes</a>
</li>
</ul>
<div id="tab0" class="tab">
<h2>Failed tests</h2>
<ul class="linkList">
<li>
<a href="../classes/tests.AppletTest.html">AppletTest</a>.
<a href="../classes/tests.AppletTest.html#transaction1()">transaction1()</a>
</li>
<li>
<a href="../classes/tests.AppletTest.html">AppletTest</a>.
<a href="../classes/tests.AppletTest.html#transaction2()">transaction2()</a>
</li>
<li>
<a href="../classes/tests.AppletTest.html">AppletTest</a>.
<a href="../classes/tests.AppletTest.html#transaction3()">transaction3()</a>
</li>
</ul>
</div>
<div id="tab1" class="tab">
<h2>Classes</h2>
<table>
<thread>
Expand All @@ -77,14 +97,14 @@ <h2>Classes</h2>
</tr>
</thread>
<tr>
<td class="success">
<td class="failures">
<a href="../classes/tests.AppletTest.html">AppletTest</a>
</td>
<td>1</td>
<td>0</td>
<td>6</td>
<td>3</td>
<td>0</td>
<td>0.171s</td>
<td class="success">100%</td>
<td>0.101s</td>
<td class="failures">50%</td>
</tr>
</table>
</div>
Expand All @@ -96,7 +116,7 @@ <h2>Classes</h2>
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 6.6</a> at 1 Jul 2022, 4:46:09 AM</p>
<a href="http://www.gradle.org">Gradle 6.6</a> at 4 Nov 2022, 1:50:38 AM</p>
</div>
</div>
</body>
Expand Down
Empty file.
Binary file not shown.
468 changes: 288 additions & 180 deletions applet/build/test-results/test/TEST-tests.AppletTest.xml

Large diffs are not rendered by default.

203 changes: 21 additions & 182 deletions applet/build/test-results/test/binary/output.bin

Large diffs are not rendered by default.

Binary file modified applet/build/test-results/test/binary/output.bin.idx
Binary file not shown.
Binary file modified applet/build/test-results/test/binary/results.bin
Binary file not shown.
38 changes: 20 additions & 18 deletions applet/build/tmp/compileJava/source-classes-mapping.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@ applet/Key.java
applet.Key
applet/Value.java
applet.Value
main/TransactionsImported.java
main.TransactionsImported
applet/GeneralMap.java
applet.GeneralMap
applet/AppletInstructions.java
applet.AppletInstructions
applet/MainApplet.java
applet.MainApplet
main/Download.java
main.Download
applet/KeyPair.java
applet.KeyPair
applet/GlobalUnsignedTXOutput.java
applet.GlobalUnsignedTXOutput
applet/GlobalUnsignedTX.java
applet.GlobalUnsignedTX
applet/FromApplet.java
applet.FromApplet
applet/GlobalUnsignedTXInput.java
applet.GlobalUnsignedTXInput
applet/SekriptInstructions.java
applet.SekriptInstructions
applet/Policy.java
applet.Policy
applet/Stack.java
applet.Stack
applet/SecretAndTimeStorage.java
applet.SecretAndTimeStorage
applet/GlobalMap.java
applet.GlobalMap
applet/GlobalUnsignedTX.java
applet.GlobalUnsignedTX
applet/PSBT.java
applet.PSBT
applet/MainApplet.java
applet.MainApplet
applet/GlobalUnsignedTXInput.java
applet.GlobalUnsignedTXInput
main/AppletControl.java
main.AppletControl
main/Run.java
main.Run
applet/FromApplet.java
applet.FromApplet
applet/GlobalUnsignedTXOutput.java
applet.GlobalUnsignedTXOutput
main/Upload.java
main.Upload
12 changes: 0 additions & 12 deletions applet/build/tmp/compileTestJava/source-classes-mapping.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
tests/TransactionsImported.java
tests.TransactionsImported
tests/Upload.java
tests.Upload
tests/Download.java
tests.Download
tests/ImpTrxUnitTests.java
tests.ImpTrxUnitTests
tests/AppletComunicationTools.java
tests.AppletComunicationTools
tests/BaseTest.java
tests.BaseTest
tests/MyTests.java
tests.MyTests
tests/AppletControl.java
tests.AppletControl
tests/AppletTest.java
tests.AppletTest
Loading

0 comments on commit 0d26c78

Please sign in to comment.