Skip to content

Instantly share code, notes, and snippets.

View tonit's full-sized avatar
🍼
Growing Developer Culture

Toni Menzel tonit

🍼
Growing Developer Culture
View GitHub Profile
TestContainerFactory factory = PaxExamRuntime
.getTestContainerFactory( PaxRunnerTestContainerFactory.class );
// we know there can be only one container
OptionDescription testTarget = factory.parse(
options(
waitForRBCFor( 2000 )
//location( "192.168.73.204", 8181 )
)
)[ 0 ];
TestContainerFactory factory = getFactory();
Option[] options = new Option[]{junitBundles(), easyMockBundles()};
for (OptionDescription testTarget : factory.parse(options)) {
TestContainer testContainer = factory.createContainer(testTarget);
try {
testContainer.start();
TestProbeBuilder probe = createProbe().addTest(Probe.class);
testContainer.install(probe.getStream());
TestContainerFactory factory = getFactory();
Option[] options = new Option[]{junitBundles(), easyMockBundles()};
ExxamReactor reactor = new DefaultExamReactor(factory);
TestProbeBuilder probe = createProbe().addTest(Probe.class);
reactor.addProbe(probe);
reactor.addConfiguration(options);
@tonit
tonit / releaseproblem123
Created December 15, 2010 21:37
mvn release:perform problems: deploys **.jar.asc as **.bundle.asc for bundles
Problem Screenshot: https://skitch.com/tonit/rfg6j/sonatype-nexus-maven-repository-manager
This is the tracked down first appearance of the misnamed artifact (bundle.asc vs. jar.asc) during mvn release:perform:
..
[INFO] [INFO] --- maven-install-plugin:2.3:install (default-install) @ pax-exam ---
[INFO] [INFO] Installing /Users/tonit/devel/oss/org.ops4j.pax.exam1/target/checkout/pax-exam/target/pax-exam-1.2.3.jar to /Users/tonit/.m2/repository/org/ops4j/pax/exam/pax-exam/1.2.3/pax-exam-1.2.3.jar
[INFO] [INFO] Installing /Users/tonit/devel/oss/org.ops4j.pax.exam1/target/checkout/pax-exam/pom.xml to /Users/tonit/.m2/repository/org/ops4j/pax/exam/pax-exam/1.2.3/pax-exam-1.2.3.pom
[INFO] [INFO] Installing /Users/tonit/devel/oss/org.ops4j.pax.exam1/target/checkout/pax-exam/target/pax-exam-1.2.3-javadoc.jar to /Users/tonit/.m2/repository/org/ops4j/pax/exam/pax-exam/1.2.3/pax-exam-1.2.3-javadoc.jar
[INFO] [INFO] Installing /Users/tonit/devel/oss/org.ops4j.pax.exam1/target/checkout/pax-exam/target/pax-exam-1.2.3-so
First make sure you prepare your environment http://wiki.ops4j.org/display/ops4j/Releasing.
Use Maven 3.
mvn -Prelease,repos.sonatype.staging -Darguments="-Prelease,repos.sonatype.staging" release:prepare
mvn -Prelease,repos.sonatype.staging -Darguments="-Prelease,repos.sonatype.staging" release:perform -Dgoals=deploy -DconnectionUrl=scm:git:file:///Users/tonit/devel/oss/org.ops4j.pax.exam1/
Hint:
1. the -DconnectionUrl is a workaround for bug http://jira.codehaus.org/browse/MRELEASE-605
@tonit
tonit / svnauthormapping.sh
Created January 7, 2011 12:55
Run this inside svn checkout to create a authors template for git svn clone
#!/usr/bin/env bash
# From http://technicalpickles.com/posts/creating-a-svn-authorsfile-when-migrating-from-subversion-to-git/
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
done
echo "# Now run git svn --authors-file=path/to/authors_file clone SVN_REPO_URL LOCAL_DIR"
@tonit
tonit / gist:840396
Created February 23, 2011 13:02
hudson-trunk-guice-problem
tarted by user anonymous
Checkout:workspace / /Users/tonit/devel/oss/pax-exam-hudson/work/jobs/Pax Repository/workspace - hudson.remoting.LocalChannel@512f0cf1
Using strategy: Default
Last Built Revision: Revision 79afe211de70aa194dd084938bb5e7636bbafda3 (origin/master)
Checkout:workspace / /Users/tonit/devel/oss/pax-exam-hudson/work/jobs/Pax Repository/workspace - hudson.remoting.LocalChannel@512f0cf1
GitAPI created
Fetching changes from the remote Git repository
Fetching upstream changes from file:///Users/tonit/devel/oss/pax-repository/.git
[workspace] $ git fetch -t file:///Users/tonit/devel/oss/pax-repository/.git +refs/heads/*:refs/remotes/origin/*
[workspace] $ git ls-tree HEAD
@tonit
tonit / FixCLRFonMac
Created March 22, 2011 08:47
Fixing Mac specific line endings to Unix defaults
find . -type f -name "*.java" -exec perl -pi -e 's/\r/\n/g' \{\} \;
@tonit
tonit / Exam2_API1.java
Created March 28, 2011 11:57
Low level api example. How to use a Test Container.
for( TestContainer testContainer : getTestContainerFactory().parse( options ) ) {
try {
testContainer.start();
testContainer.install( p.getStream() );
for( TestAddress test : p.getTests() ) {
testContainer.call( test );
}
} finally {
testContainer.stop();
}
@tonit
tonit / Exam2_API2.java
Created March 28, 2011 12:19
How to make a test probe. Entry API (PlumbingContext) will change prior 2.0 final.
private TestProbeProvider makeProbe() throws IOException
{
TestProbeBuilder probe = new PlumbingContext().createProbe();
probe.addTests(
SingleTestProbe.class,
getAllMethods( SingleTestProbe.class )
);
return probe.build();
}