-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from anastaciocintra/travis
Travis
- Loading branch information
Showing
6 changed files
with
222 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
language: java | ||
jdk: openjdk8 | ||
cache: | ||
directories: | ||
- $HOME/.m2 | ||
|
||
before_install: | ||
- if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi | ||
- if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi | ||
|
||
install: mvn install --settings .travis/settings.xml -DskipTests -Dmaven.javadoc.skip=true -B | ||
|
||
script: | ||
mvn clean deploy --settings .travis/settings.xml -DskipTests=true -B | ||
|
||
notifications: | ||
email: | ||
- anastaciocintra@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | ||
http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<servers> | ||
<server> | ||
<id>ossrh-staging</id> | ||
<username>${env.SONATYPE_USERNAME}</username> | ||
<password>${env.SONATYPE_PASSWORD}</password> | ||
</server> | ||
<server> | ||
<id>ossrh-snapshots</id> | ||
<username>${env.SONATYPE_USERNAME}</username> | ||
<password>${env.SONATYPE_PASSWORD}</password> | ||
</server> | ||
</servers> | ||
<profiles> | ||
<profile> | ||
<id>ossrh</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable> | ||
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</settings> | ||
|
||
<!-- # gpg --export-ownertrust | base64 -w 0 >>> GPG_OWNERTRUST--> | ||
<!-- # ppg -a --export-secret-keys anastaciocintra@gmail.com |base64 -w 0 >>> GPG_SECRET_KEYS--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
escpos-coffee/src/test/java/com/github/anastaciocintra/escpos/EscPosTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.github.anastaciocintra.escpos; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.BufferedOutputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.OutputStream; | ||
|
||
import static com.github.anastaciocintra.escpos.EscPosConst.ESC; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class EscPosTest { | ||
|
||
|
||
@Test | ||
void setPrinterCharacterTableTest() throws Exception{ | ||
ByteArrayOutputStream result = new ByteArrayOutputStream(); | ||
EscPos escpos = new EscPos(result); | ||
|
||
escpos.setPrinterCharacterTable(10); | ||
escpos.close(); | ||
ByteArrayOutputStream expected = new ByteArrayOutputStream(); | ||
expected.write(ESC); | ||
expected.write('t'); | ||
expected.write(10); | ||
|
||
assertArrayEquals(expected.toByteArray(), result.toByteArray()); | ||
|
||
} | ||
@Test | ||
void pulsePinTestCase() throws Exception{ | ||
ByteArrayOutputStream result = new ByteArrayOutputStream(); | ||
EscPos escpos = new EscPos(result); | ||
|
||
escpos.pulsePin(EscPos.PinConnector.Pin_2, 50, 75); | ||
escpos.close(); | ||
|
||
ByteArrayOutputStream expected = new ByteArrayOutputStream(); | ||
expected.write(ESC); | ||
expected.write('p'); | ||
expected.write(EscPos.PinConnector.Pin_2.value); | ||
expected.write(50); | ||
expected.write(75); | ||
|
||
assertArrayEquals(expected.toByteArray(), result.toByteArray()); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters