alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (README)

This example Java source code file (README) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

all, for, ip\/port, jdp, jtreg, start, the, there, these, this, utility

The README Java example source code

The following test were contributed by dmitry.samersoff@oracle.com and will be ported in the near future:
JdpClient.java
JdpDoSomething.java  
JdpTest.sh  
JdpUnitTest.java


JdpTest.sh:
-------------------------------------
test_01 - basic test, check if JDP packet assembler and other
          parts of JDP is not broken

test_02 - test if JDP starts with custom parameters. (disabled)

test_03 - test if jcmd is able to start jdp with
          custom parameters (disabled)

test_04 - test if JDP starts with default parameters (disabled)

test_05 - test if jcmd is able to start jdp with default
          parameters (disabled)

Only test_01 is enabled at the moment.

JdpUnitTest.java: contains unit tests used under development.


==========================================================================
The other Java-based tests in this folder are contributed by alex.schenkman@oracle.com

There are three Jdp test cases in this folder:
 1) Jdp is turned off.
 2) Jdp is turned on, using default values
 3) Jdp is turned on, using a specific IP and port

For the test cases above, the actual tests are:
 1) JdpOffTestCase.java
 2) JdpOnTestCase.java
 3) JdpOnTestCase.java, using different parameters.
All these three test are implemented as subclasses of JdpTestCase.java.

For all of these three tests, the VM sending the Jdp packets is also catching them.
That is, while the VM itself is sending Jdp multicast packets, the program executed by
that same VM is listening for those packets.

These tests above work as follows:
 1) Start a VM with Jdp off, make sure that no Jdp packets arrive at the default IP/port.
 2) Start a VM with Jdp on, make sure three packets arrive at the default IP/port.
 3) Start a VM with Jdp on a specific IP/port, make sure three packets arrive.

To make sure that we are not catching Jdp packets from some other VM, the INSTANCE_NAME
attribute is set to a unique id. The setting of this unique id is done by a launcher.
There are three launchers, one for each of the tests above:
 1) JdpOffTest.java
 2) JdpDefaultsTest.java
 3) JdpSpecificAddressTest.java
All these three tests are implemented as subclasses of DynamicLauncher.java.

So, JdpOffTest.class will execute JdpOffTestCase.class (using ProcessTools),
and that will exercise test case nr.1; and so on for the other cases.

These launchers are also the entry points for JTreg.
This means that JTreg will only see these launchers as tests.
You might run the tests without JTreg, as long as you specify all the VM optiones needed.
Look at the launcher to determine what is needed. Do not forget -Dtest.jdk, that is set by JTreg.

JMX must be enabled in order to enable Jdp. This requires a free port (com.sun.management.jmxremote.port).
To avoid port-busy conflicts, DynamicLauncher.java will try to find a free port up to three times.

There are some other tests used for test development, and not meant to be run automatically by JTreg.
 1) PortAlreadyInUse.java, used to test the retry mechanism to find a free port.
 2) PacketTest.java, Jdp packet sanity.
 3) JdpTestUtil.java, Utility functions to read a Jdp packet.
 4) JdpTestUtilTest.java, Unit tests for JdpTestUtil.java

Other Java examples (source code examples)

Here is a short list of links related to this Java README source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.