Mycontainer Classpath Scanner

Test Light Weight Container

License

License

Categories

Categories

Container
GroupId

GroupId

com.googlecode.mycontainer
ArtifactId

ArtifactId

mycontainer-cpscanner
Last Version

Last Version

1.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

Mycontainer Classpath Scanner
Test Light Weight Container
Project Organization

Project Organization

Mycontainer Team

Download mycontainer-cpscanner

How to add to project

<!-- https://jarcasting.com/artifacts/com.googlecode.mycontainer/mycontainer-cpscanner/ -->
<dependency>
    <groupId>com.googlecode.mycontainer</groupId>
    <artifactId>mycontainer-cpscanner</artifactId>
    <version>1.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.googlecode.mycontainer/mycontainer-cpscanner/
implementation 'com.googlecode.mycontainer:mycontainer-cpscanner:1.5.0'
// https://jarcasting.com/artifacts/com.googlecode.mycontainer/mycontainer-cpscanner/
implementation ("com.googlecode.mycontainer:mycontainer-cpscanner:1.5.0")
'com.googlecode.mycontainer:mycontainer-cpscanner:jar:1.5.0'
<dependency org="com.googlecode.mycontainer" name="mycontainer-cpscanner" rev="1.5.0">
  <artifact name="mycontainer-cpscanner" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.googlecode.mycontainer', module='mycontainer-cpscanner', version='1.5.0')
)
libraryDependencies += "com.googlecode.mycontainer" % "mycontainer-cpscanner" % "1.5.0"
[com.googlecode.mycontainer/mycontainer-cpscanner "1.5.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.6.1

test (4)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.6.1
log4j : log4j jar 1.2.14
junit : junit jar 4.0
hsqldb : hsqldb jar 1.8.0.7

Project Modules

There are no modules declared in this project.

Mycontainer

Build Status Build Status

Purpose

Mycontainer is a generic test and development enviroment. Check it out.

@Before

You will need java and maven

Starting all modules from maven

Configure mycontainer maven plugin: pom.xml

Write the beanshell: mycontainer-start.bsh. You can write this in any java class and just use that in beanshell

mvn mycontainer:start

Start a local web server

No pom.xml required. And it is nice to quick start html, javascript and css projects.

$ mvn com.googlecode.mycontainer:mycontainer-maven-plugin:web -Dmycontainer.web.port=8080

TCP Tunnels

Mycontainer can start multiple tcp tunnels. You can do this using java -cp or mvn (pom.xml is not required)

$ java -cp mycontainer-util.jar com.googlecode.mycontainer.util.tunnel.Tunnels Redirect 0.0.0.0:6667:chat.freenode.net:6667 5080:google.com:80

You can get this jar here

The first argument can be Console (System.out) or Log (slf4j/jdk-logging) to show transfered data. Or Redirect to just redirect it silently.

Others arguments describes tunnels to startup. [local-host]:local-port:remote-host:remote-port.

local-host is not required (default 127.0.0.1). Use 0.0.0.0 to bind on all interfaces.

local-port can be zero to bind on a free random port.

You can also start it by maven (pom.xml is not required). It is an aggregator plugin.

$  mvn com.googlecode.mycontainer:mycontainer-maven-plugin:tunnels -Dmycontainer.tunnels.list=5000:localhost:6000,0.0.0.0:6667:chat.freenode.net:6667 -Dmycontainer.tunnels.handler=Console

Like the java -cp you need to tell Redirect, Console or Log (mycontainer.tunnels.handler) and tunnels (mycontainer.tunnels.list) separeted by comma.

Checking for non us-ascii files

Checking recursively for non-ascii files (pom.xml is not required):

$ mvn com.googlecode.mycontainer:mycontainer-maven-plugin:us-ascii

You can configure your pom.xml to check it on test maven phase like we do pom.xml. Use <inherited>false</inherited> if you are configuring your root pom.xml at multi modules project.

Installing PhantomJS

Mycontainer has a plugin to install PhantomJS.

  • Download packages from original host: https://bitbucket.org/ariya/phantomjs/downloads
  • Install the correct package (windows, macosx, linux).
  • No pom.xml required
  • It set a maven property to the phantomjs executable: mycontainer.phantomjs.executable

Maven command:

$ mvn com.googlecode.mycontainer:mycontainer-maven-plugin:phantomjs-install -Dmycontainer.phantomjs.dest=target/phantomjs -Dmycontainer.phantomjs.version=1.9.2

Maven Repository

This project is deployed to maven central repository. Example:

<dependency>
    <groupId>com.googlecode.mycontainer</groupId>
    <artifactId>mycontainer-web</artifactId>
    <version>${mycontainer.version}</version>
</dependency>

Building Mycontainer

mvn clean install

Use -Ddist to assembly a all-in-one jar and a binary zip.

Speed up the process:

mvn clean install -Dmaven.test.skip.exec -T 10 && mvn test

Embedding Mycontainer to do some GAE stuff

Configure pom.xml to Google App Engine

Use GAETestHelper.java or code like that.

Google has LocalServiceTestHelper to do unit tests, but it requires a thread environment. It means we need to keep the env to each request thread. This filter LocalServiceTestHelperFilter.java does the job using a non-documented google class ApiProxy.

Embedding Mycontainer to do some Java EE stuff

Configure InitialContext. You can do with jndi.properties

Code like MycontainerTestHelper.java to embed anywhere.

Here is a junit sample: AbstractWebBaseTestCase.java / MycontainerWebTest.java

  • Embeddable on any java application (junit tests, jetty, tomcat, and any others)
  • Programmatic configuration and deploy
  • Light weight
  • Fast boot
  • Do not hijack the Java Virtual Machine (real embeddable):
    • Do not change JVM URL protocols configs
    • No dynamic classloader
    • No classloader isolation

Versions

Version
1.5.0
1.4.11
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.0
1.2.59
1.2.56
1.2.51
1.2.46
1.2.29