A blog about my daily tech ramblings.

Wednesday, 30 September 2015

Building a C/C++ project on Travis CI

September 30, 2015 Posted by Sachin Handiekar , , No comments
Let's see how we can use Travis CI for building a C/C++ project on Travis CI. We'll use the consoleRadio C application which is used to stream Shoutcast Radio as an example

The .travis.yml file for the consoleRadio application looks like the following -

Installing a custom version of cmake
We can install a custom version of cmake in Travis CI, using the following script -

Building a library from source
A library/dependency in Travis CI can be build from source and installed on Travis CI env.  -

1. Let's build the mpg123 library from source and install it on Travis CI. In .travis.yml, we'll have the following config -

2. We'll create a bash script (installMPG123.sh) with the following content -

Tuesday, 8 September 2015

Friday, 4 September 2015

Conditionally ignoring tests in JUnit

September 04, 2015 Posted by Sachin Handiekar , No comments
We might require to ignore a jUnit test based on a certain condition. jUnit just comes up with a @Ignore annotation which can be used to ignore the test.

We can use the below code to check if the condition has been met or not to ignore a test.

Reference : http://stackoverflow.com/questions/1689242/conditionally-ignoring-tests-in-junit-4

Thursday, 20 August 2015

Monday, 29 June 2015

Custom Error page in Gatein - jBoss Portal 6.1

June 29, 2015 Posted by Sachin Handiekar , , No comments

Steps to add a custom error page in GateIn (jBoss Portal 6.1)

1. Create the error pages and place them in the $JPP_HOME/gatein/gatein.ear/portal.war/error/ directory.

For each error code that shall have its custom error page, add the element to the $JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/web.xml file. This element specifies what page is displayed when the particular error code is returned. 

The sample code below ensures that the 404.html page is displayed when the 404 error code is returned.

Specify the error page locations as static resources in the controller.xml file. The code sample below demonstrates this configuration for the /404.html path. The file is located at $JBOSS_PORTAL/standalone/configuration/gatein/ folder.

Without this configuration, the portal tries to resolve /404.html as a name of a portal or another resource. It is therefore necessary to configure the error page locations as static resources. 

3. Add the Custom Portlet Request Handler in GateIn. (Ref :https://access.redhat.com/solutions/47434)

Build the project available at - https://github.com/martinweiler/CustomPortalRequestHandler and copy the jar to $JPP_HOME/modules/system/layers/gatein/org/gatein/lib/main

Edit the $JPP_HOME/modules/system/layers/gatein/org/gatein/lib/main/module.xml, and add the following to the end of element:

Edit $JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/controller-configuration.xml, and apply the following change:

4. Browse to any invalid link in jBoss Portal - http://localhost:8080/portal/invalid-link and see the custom error page. 

Note: To have a custom error page on the root (/) domain. Create a war file with the following web.xml or use the project - https://github.com/sachin-handiekar/jboss-utils/error/

Sunday, 21 June 2015

Friday, 20 March 2015

Saturday, 14 March 2015

Custom Invocation Handler for Gatein WSRP

March 14, 2015 Posted by Sachin Handiekar , No comments
We'll be creating a custom invocation handler for WSRP using the Gatein WSRP Extension. For this example code we'll be sending two custom attributes (CustomerID & OrderID) from our consumer to the producer.

Source code available at Github


Utility class


Monday, 9 March 2015