Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Andrii Grytsyk agritsik

🌴
On vacation
Block or report user

Report or block agritsik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@agritsik
agritsik / maven-javaee7.sh
Created Apr 24, 2016
Maven archetype for java ee 7 microservice
View maven-javaee7.sh
#!/usr/bin/env bash
mvn archetype:generate \
-DarchetypeGroupId=com.agritsik.maven.archetypes \
-DarchetypeArtifactId=javaee7-micro \
-DarchetypeVersion=1.0-beta-1
# mvn test -Parquillian-glassfish
# OR
# mvn test -Parquillian-wildfly
@agritsik
agritsik / ResourceTest.java
Last active Apr 24, 2016
JEE e2e testing with Arquillian and Glassfish
View ResourceTest.java
import junit.framework.TestCase;
import org.glassfish.jersey.filter.LoggingFilter;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
@agritsik
agritsik / ServiceTest.java
Last active Apr 24, 2016
JEE integration testing with Arquillian and Glassfish
View ServiceTest.java
import junit.framework.TestCase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@agritsik
agritsik / maven-quickstart.sh
Last active Apr 25, 2016
Maven quickstart archetype
View maven-quickstart.sh
#!/usr/bin/env bash
mvn archetype:generate \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DgroupId=com.agritsik.samples.app \
-DartifactId=test-app
# mvn package && java -cp target/test-app-1.0-SNAPSHOT.jar com.agritsik.samples.app.App
# Output example: Hello World!
@agritsik
agritsik / docker-wait-for-connection.sh
Created Apr 22, 2016
How to wait for another docker container
View docker-wait-for-connection.sh
# note, netcat utility should be installed in docker container
while ! nc -z DB 3306; do sleep 3; done
# DB is available here, so we can start our applicaiton
# java -jar /app.jar
@agritsik
agritsik / docker-cleanup.sh
Created Apr 21, 2016
How to remove all docker containers and images
View docker-cleanup.sh
#!/usr/bin/env bash
# Remove all stopped containers
docker rm -v $(docker ps -a -q)
# Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
@agritsik
agritsik / docker-file-glassfish.sh
Created Apr 21, 2016
Docker file for glassfish
View docker-file-glassfish.sh
# Glassfish container configured for Blog app
#
# VERSION 0.1
FROM glassfish
MAINTAINER Andrii Grytsyk
RUN apt-get update
RUN curl http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar -o glassfish/lib/mysql-connector-java-5.1.34.jar
@agritsik
agritsik / glassfish-deps-versions.sh
Created Apr 21, 2016
Find out glassfish dependency versions
View glassfish-deps-versions.sh
# check Jersey version
unzip -p jersey-common.jar META-INF/MANIFEST.MF | grep Bundle-Version
# Output example: Bundle-Version: 2.10.4
# check Eclipselink version
unzip -p org.eclipse.persistence.core.jar META-INF/MANIFEST.MF | grep Bundle-Version
# Output example: Bundle-Version: 2.5.2.v20140319-9ad6abd
# check JSF version
unzip -p javax.faces.jar META-INF/MANIFEST.MF | grep Bundle-Version
@agritsik
agritsik / glassfish-clear.sh
Created Apr 20, 2016
Clear glassfish cache
View glassfish-clear.sh
#!/usr/bin/env bash
rm -rf $GLASSFISH_HOME/glassfish/domains/domain1/generated/*
rm -rf $GLASSFISH_HOME/glassfish/domains/domain1/osgi-cache/*
rm -rf $GLASSFISH_HOME/glassfish/domains/domain1/applications/*
@agritsik
agritsik / rest-check.sh
Last active Apr 20, 2016
How to check REST API
View rest-check.sh
#!/usr/bin/env bash
# returns response body and headers
curl -i http://localhost:8080/app/resources/countries
# returns response body and headers in verbose mode, useful for debugging
curl -v http://localhost:8080/app/resources/countries
# returns response body and headers
wget -qSO - http://localhost:8080/app/resources/countries
You can’t perform that action at this time.