Pictures from my trip to Raleigh, NC when I started with Red Hat

Here’s my self-indulgent little post about my trip to Raleigh for my new hire orientation when I joined Red Hat this month. I thought you might like to see just a little of what it’s like to join the most important open source company in the world from a West Coast guy’s perspective.

First, I had to get used to the green. Sure, I lived in Seattle for almost five years, but the South is like fluorescent green by comparison.

2014-05-11 18.54.56Next, here’s a view of Red Hat’s cafeteria in their Raleigh headquarters. I used to work at the Intel where Craig Barrett (the CEO) was based and I even worked at Microsoft in Redmond for a short while, but this is quite a bit nicer (if a bit smaller):

2014-05-12 12.26.43Later that first night, I hung out with some of the other new hires at a cool little place right down the street called Cala*Vela for happy hour where my spicy margarita was spicy for real. After that, I just kind of walked around downtown Raleigh around the Fayetteville mall. I got a few pictures of the capitol and the supreme court, each of which is photogenic.

2014-05-12 20.16.562014-05-12 20.32.46And of course, being from the Left Coast, I couldn’t resist this shot:

2014-05-12 21.45.40Luckily they let me back in the building the next day:

2014-05-13 08.10.37And they even gave me a red fedora:

2014-05-13 15.56.17I think it was Tuesday or Wednesday night that I looked around for something else cool to do, which wasn’t hard in Raleigh. There’s a lot of tech and a lot of software. I went to a security/infosec meetup and met some really cool guys (yes, they were all guys) at a real brew pub called Crank Arm Brewing — and the beer was really, really good. We ended up bouncing around a few local places and ultimately ended up at The Pit for a late brisket dinner.

Hey Raleigh is too small for me, but now I understand “the thing” that’s been drawing people there. It’s inviting, warm, and happy. The people are cool and comfortable. The beer is (very) good. The tech is even better. I hope I’ve got a few more trips in my future out there.

2014-05-13 19.02.352014-05-13 20.40.582014-05-13 21.43.05The way home was exciting for a guy who’s only crossed the Mississippi a handful of times in his life. The “adventure” started with a killer (I do mean “killer” from a cardiac surgeon’s point of view) chicken and waffles from Beasley’s but then tornado warnings and “severe rain” warnings lit up my phone. I did, as a matter of fact, get completely soaked on the 0.25 mile walk from Red Hat to the hotel; my clothes were still wet the next morning in LA when I took them out of the suitcase. I used to think Arizona had torrential rains during the monsoons — I’ve revised my understanding of rainstorms since the trip.

2014-05-15 19.40.37The most cliche part of the trip (aside from the ‘Vette with the stars and stripes), however, was when I got back to LA. Of course my flight got delayed out of Raleigh an hour or so because of the rain and when I was driving back up the 110 through downtown LA to Pasadena I got hit with heavy, heavy traffic. It took me and hour and a half to get from LAX to Pasadena for a drive that should only take about 25 minutes, which wouldn’t be all that surprising except for the fact that it was almost midnight on a Thursday night. Oh LA. I love you.

2014-05-15 23.13.57

Time to come back to Firefox? Maybe… just maybe…

I posted this in the Open Source LA meetup too, but I thought it was worth repeating here:

new-firefox-versionFull confession: I’ve been on Chrome basically since it came out. I abandoned Firefox years ago because it was slow, bloated, etc… In fact, in even fuller, richer, Technicolor confession: I even started the Open Source LA Meetup group using Chrome.

But I think it’s kind of serendipitous that on roughly the same day that I got the group launched, Firefox released a fantastic new version of the browser. And I don’t need to confess anything to tell you that I’m using it now.

I know all the blah, blah, blah with Mozilla and some guy named Brandon and so on… but maybe those just dark days for Mozilla’s and in a era of you-as-a-product-because-you-use-Chrome and a new era of conscientiousness around things like open source… maybe Mozilla’s (and Firefox’s) very best days are ahead.

In a bold move for me, I already made it my default browser.

Building an open source community

group-photoToday I created a new Meetup group called Open Source LA. I don’t know if it will go anywhere, but I think there’s room for this kind of group.

And I posted a message to the group, which currently consists of just me, paraphrasing David Hurley’s recent opensource.com post:

(1) You are still on the hook for support: just because you open source the project doesn’t mean that any developers are going to jump out there and answer support questions.

(2) You need to be the innovator: just because other people can fork and enhance your code doesn’t mean they will; your codebase will likely stagnate without your heavy involvement.

(3) Nurture your contributors: why should anyone help you? If you were building a community playground together, how would you encourage people to help? (Actually, Mr. Hurley put this point quite differently, but this is my post so I get to paraphrase.)

(4) Explain your mission, make it transparent, and stick to it closely.

(5) Fail fast: this is kind of obvious to me at a product level, but I think the idea of “failing” in front of a whole community by writing crappy code or making shoddy architectural choices is something a lot of coders — including me — fear. Don’t.

I hope you’ll consider joining my little Meetup group — or at least tell me why I should fail fast! The group is here: Open Source LA.

Getting started with JBoss AS 7 and OpenShift — the absolute minimum

tweet-openshitStep one: First of all, do yourself a huge favor and take advantage of RedHat’s free giveaway for Getting Started With OpenShift.

openshift-getting-startThe O’Reilly edited free ebook doesn’t cover Java or JBoss or enterprise stuff specifically, but it’s generally written at just the right level to get you started as a developer. Honestly, I played around with Heroku and a few other PaaS services, and I struggled a little until I found OpenShift and the book. Do it!

Step two: sign up for an OpenShift account. You’re a developer, you’re smart enough to figure this one out.

openshift-signup

Step three: download and install the OpenShift RHC Client tools so that you can interact with the OpenShift server through the command line. Are you assuming you’d rather work with GUI? I get it, but the command line tools are more powerful. Just take it on faith for now.

openshiftTo install the RHC Client Tools, you actually need to install Ruby first to get access to the gem package management service, but don’t worry too much about it; the process is pretty straight forward. The documentation explains it well, and it’s easy.

Step three: deploy a fresh JBoss AS 7 instance (cartridge on a fresh gear, in OpenShift lingo) in less than a minute by typing the following:

[code lang=”java”]
rhc create-app test jbossas-7
[/code]

You’ll see something like this:

openshift-console

Nicely done. You’ve just deployed a JBoss AS 7 instance. Point your browser at the URL listed and you’ll see something line this.

openshift-web

Pretty amazing considering how much work used to go into setting up a new application server on the ‘net.

I’ll do some more posts to go into more detail later, but I hope this gives you the confidence to go forward. The OpenShift service is pretty amazing.

 

Maven Surefire + Failsafe, the easiest way

Tell me I’m not the only one. Your web application has a bunch of unit tests, and Cobertura says all kinds of nice things about your coverage. But every now and then you check something in and the build breaks. But it worked locally, so what the hell?

mavenThen you realize that one of the tests depends on a REST call to some other system, and they changed their data. In other words, you realize that you, my friend, have a mix of unit tests and integration tests.

Don’t panic. Just add the Maven Failsafe plugin to your build. Failsafe is similar to the default testing plugin that you already know and love: Surefire. But it’s specifically made to run integration tests. There’s a lot of great documentation, but I hope this example will get you up and running faster than I did.

Step one: add the Failsafe plugin to your pom

[code lang=”xml”]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[/code]

Unfortunately, the Failsafe plugin doesn’t come out of the box like Surefire does so you have to explicitly add it to your build.

Step two: separate your unit and integration tests by convention

By default, the Surefire plugin will pick up any classes named *Test.java or *TestCase.java. By contrast, Failsafe picks up any classes named *IT.java. That’s nice because you can let them coexist in the same src/test/java folder.

src-test

Just for reference, here’s my “code” for the Demo tests:

[code lang=”java”]
public class DemoTest {
@Test
public void test() {
System.out.println("Hi. I’m a unit test.");
}
}
[/code]

 

[code lang=”java”]
public class DemoIT {
@Test
public void test() {
System.out.println("And I’m an integration test. Can’t you tell?");
}
}
[/code]

Step three: run mvn verify and check the output

The verify life cycle runs both test and the integration tests (check the documentation for a lot of important detail):

mvn-verify

You’ll see it run the normal unit tests:

demotest

And then it runs again for the integration tests:

demoit

As to how you’re going to integrate this life cycle into Jenkins, Bamboo, or whatever — I’ll leave that up to you! Good luck out there and let me know how it goes.