Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on January 04, 2013 14:35:14    Last update: January 04, 2013 14:35:41
You can use the runOrder parameter to control the test execution order for Maven surefire tests: <build> <plugins> <plugin> ... Other options are: Option Meaning alphabetical Alphabetical reversealphabetical Reverse Alphabetical random Randomized hourly alphabetical on even hours, reverse alphabetical on odd hours failedfirst Failed first will run tests that failed on previous run first, as well as new tests for this run. balanced Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to make all tests complete at the same time, reducing the overall execution time. filesystem This is the default. I guess this is the order returned by the file system: uncontrolled but deterministic.
Created by Fang on January 04, 2013 14:16:58    Last update: January 04, 2013 14:16:58
Junit does not support specifying execution order of tests until 4.11. The methods were simply invoked in the order returned by the reflection API. So, the tests are executed in a unspecified but deterministic order, i.e., you have no control over the order of execution, but if you repeat the tests, they are run in the same sequence each time. For version 4.11, you can specify the order with the FixMethodOrder annotation: import org.junit.runners.MethodSorters; imp... From the release notes : Test execution order By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify...
Created by Fang on January 04, 2013 08:00:37    Last update: January 04, 2013 08:00:37
This is a Maven POM that prints out some built-in project properties: <project xmlns="http://maven.apache.org/PO... Output: $ mvn validate [INFO] Scanning for projects.....
Created by Fang on March 06, 2012 12:24:53    Last update: March 06, 2012 12:24:53
Validation groups can be used to control which rules validation rules to run. A validation group can be identified by any Java interface (not class!). Multiple validation groups may be specified when validating. In this example, I added a validation group named MyValidationGroup ( src/main/java/com/example/MyValidationGroup.java in Maven project): package com.example; public interface MyVal... and added a @Size rule for a person's name, because my database can only store up to 15 characters for a person's name: package com.example; import javax.validatio... Now validate Person with a JUnit test ( src/test/java/com/example/TestPersonWithGroup.java in Maven project): package com.example; import java.util.Set; ... Test with " mvn clean test ". The rules where groups is not specified, which belong to the javax.validation.groups.Default group, are not executed with these tests.
Created by Fang on September 07, 2009 20:44:15    Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app : <project> <modelVersion>4.0.0</modelVersion>... Create a directory named ear under javaee-app . Create pom.xml under ear : <project> <modelVersion>4.0.0</modelVersion>... Modify pom.xml in the webapp directory so that it looks like this: <project> <modelVersion>4.0.0</modelVersion> ... Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Fang on October 28, 2011 13:49:40    Last update: October 30, 2011 19:23:25
This is a simple example to demonstrate the templating power of JSF facelets. If you've used struts tiles before, you'll recognize the simplicity of templating with facelets. I've stripped out everything else except the pages themselves, just to put our focus on facelets. This is a Maven based project, and you need Tomcat (or any servlet container) to run the resulting webapp. To begin with this is the list of files: ./pom.xml ./src/main/webapp/home.xhtml ./src... I left faces-config.xml in there for completeness sake, it may not be needed. The Maven POM ( pom.xml ): <?xml version="1.0" encoding="UTF-8"?> <project... Web app configuration ( WEB-INF/web.xml ): <?xml version="1.0" encoding="UTF-8"?> <web-app... Empty WEB-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <!-- Thi... index.jsp is simply a redirect to home.jsf : <% response.sendRedirect("home.jsf"); %>...
Created by magnum on September 27, 2011 11:57:49    Last update: October 05, 2011 12:20:00
This procedure sets up an IPSec vpn server on Linux with Preshared Key (PSK) using Openswan . Install Openswan: # yum install openswan Edit /etc/ipsec.conf . This is about the minimum needed to run IPSec server. Instead of running L2TP on port 1701, I'm running TCP on port 8080 so that I can test the setup with nc later. # /etc/ipsec.conf - Openswan IPsec configurati... Edit /etc/ipsec.secrets . # # Preshared key for clients connecting from a... Start IPSec: # /etc/init.d/ipsec start Check status: # ipsec auto --status Monitor IPSec log: # less /var/log/secure If IPSec is running KLIPS, you should see a new nic ( ipsec0 ). There's no ipsec0 if IPSec is running NETKEY. # ifconfig eth0 Link encap:Ethernet HWadd...
Created by woolf on September 21, 2011 16:23:06    Last update: September 21, 2011 16:24:29
VirtualBox creates/uses a network adapter named vboxnet0 on the host, when a VM network adapter is connected as "host-only". As the VM starts, VirtualBox assigns the IP address 192.168.56.1 to vboxnet0 on the host. The VM DHCP client grabs the IP address 192.168.56.101 from the VirtualBox DHCP server. Connectivity is limited between the VM and the host - unless you configure NAT and IP forwarding on the host. For OpenWRT, if the DHCP client is not started automatically: #/sbin/udhcpc -i br-lan -p /var/run/udhcpc.pid -s ...
Created by meiu on July 21, 2011 09:34:10    Last update: July 21, 2011 11:00:42
Click Project -> Properties Select "Builders" Click "New", select "Ant Builder", click "OK" Select the Buildfile, set the Base Directory Set targets You may or may not want the default "Java Builder". Uncheck it if you don't want to run the default builder.
Created by Dr. Xi on July 08, 2011 09:37:03    Last update: July 08, 2011 09:37:03
A security manager is automatically installed when you run an applet, but not so when you run an application. Setting the java.security.manager property enables the default Security Manager for the application. For example, you can bind to a "privileged" port without security manager: $ java SocketBind localhost:83 Binding to local... With security manager, it fails: $ java -Djava.security.manager SocketBind loca...
Previous  1 2 3 4 Next