Skip to content

Commit

Permalink
Merge pull request #26 from anastaciocintra/travis
Browse files Browse the repository at this point in the history
Travis
  • Loading branch information
anastaciocintra committed Oct 9, 2019
2 parents a358421 + 85c1abb commit 130c5a6
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .travis.yml
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
32 changes: 32 additions & 0 deletions .travis/settings.xml
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 &#45;&#45;export-ownertrust | base64 -w 0 >>> GPG_OWNERTRUST-->
<!-- # ppg -a &#45;&#45;export-secret-keys anastaciocintra@gmail.com |base64 -w 0 >>> GPG_SECRET_KEYS-->
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@

# escpos-coffee

Java library for ESC/POS printer commands. Can send text, images and barcodes to the printer.
All commands are send to one OutputStream, than you can redirect to printer, file or network.




![GitHub](https://img.shields.io/github/license/anastaciocintra/escpos-coffee)
![Maven Central](https://img.shields.io/maven-central/v/com.github.anastaciocintra/escpos-coffee)
[![Build Status](https://travis-ci.org/anastaciocintra/escpos-coffee.svg?branch=master)](https://travis-ci.org/anastaciocintra/escpos-coffee)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.github.anastaciocintra/escpos-coffee?server=https%3A%2F%2Foss.sonatype.org)

## Getting Started
The EscPos works with OutputStream to send its commands. Here we have two examples that show different output streams.

Expand Down
79 changes: 27 additions & 52 deletions escpos-coffee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
<packaging>jar</packaging>


<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


<build>
Expand Down Expand Up @@ -99,15 +106,28 @@
</executions>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform-surefire-provider.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter-engine.version}</version>
</dependency>
</dependencies>
</plugin>

</plugins>

<extensions>
<extension>
<groupId>io.packagecloud.maven.wagon</groupId>
<artifactId>maven-packagecloud-wagon</artifactId>
<version>${maven-packagecloud.version}</version>
</extension>
</extensions>


<resources>
<resource>
Expand All @@ -120,51 +140,6 @@



<name>escpos-coffee</name>
<description>
Java library for ESC/POS printer commands. Can send text, images and barcodes to the printer.
All commands are send to one OutputStream, than you can redirect to printer, file or network.
</description>
<url>https://github.com/anastaciocintra/escpos-coffee</url>

<organization>
<name>github.com/anastaciocintra</name>
<url>https://github.com/anastaciocintra</url>
</organization>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/anastaciocintra/escpos-coffee/issues</url>
</issueManagement>

<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/anastaciocintra/escpos-coffee/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/anastaciocintra/escpos-coffee</url>
<connection>
scm:git:git://github.com/anastaciocintra/escpos-coffee.git
</connection>
<developerConnection>
scm:git:ssh://git@//github.com/anastaciocintra/escpos-coffee.git
</developerConnection>
</scm>

<developers>
<developer>
<name>Marco Antonio Anastacio Cintra</name>
<email>anastaciocintra@gmail.com</email>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>



Expand Down
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());

}


}
89 changes: 86 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


<properties>
<revision>3.0.0</revision>
<revision>3.0.1-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
Expand All @@ -26,12 +26,86 @@
<maven-site.version>3.8.2</maven-site.version>
<maven-deploy.version>2.8.2</maven-deploy.version>
<maven-gpg.version>1.6</maven-gpg.version>
<junit-jupiter-api.version>5.5.2</junit-jupiter-api.version>
<maven-surefire.version>2.21.0</maven-surefire.version>
<junit-platform-surefire-provider.version>1.2.0-M1</junit-platform-surefire-provider.version>
<junit-jupiter-engine.version>5.2.0-M1</junit-jupiter-engine.version>


</properties>

<maven-packagecloud.version>0.0.6</maven-packagecloud.version>

</properties>
<name>escpos-coffee</name>
<description>
Java library for ESC/POS printer commands. Can send text, images and barcodes to the printer.
All commands are send to one OutputStream, than you can redirect to printer, file or network.
</description>
<url>https://github.com/anastaciocintra/escpos-coffee</url>

<organization>
<name>github.com/anastaciocintra</name>
<url>https://github.com/anastaciocintra</url>
</organization>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/anastaciocintra/escpos-coffee/issues</url>
</issueManagement>

<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/anastaciocintra/escpos-coffee/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/anastaciocintra/escpos-coffee</url>
<connection>
scm:git:git://github.com/anastaciocintra/escpos-coffee.git
</connection>
<developerConnection>
scm:git:ssh://git@//github.com/anastaciocintra/escpos-coffee.git
</developerConnection>
</scm>

<developers>
<developer>
<name>Marco Antonio Anastacio Cintra</name>
<email>anastaciocintra@gmail.com</email>
<url>https://github.com/anastaciocintra</url>
<roles>
<role>Lead Developer</role>
</roles>
</developer>


<developer>
<name>Derick Felix</name>
<url>https://github.com/derickfelix</url>
<roles>
<role>developer</role>
</roles>
</developer>

<developer>
<name>Muraveiko Oleg U.</name>
<url>https://github.com/Muraveiko</url>
<roles>
<role>developer</role>
</roles>
</developer>

<developer>
<name>papuscoder</name>
<url>https://github.com/papuscoder</url>
<roles>
<role>developer</role>
</roles>
</developer>

</developers>


<modules>
Expand Down Expand Up @@ -133,5 +207,14 @@
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter-api.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

</project>

0 comments on commit 130c5a6

Please sign in to comment.