for (int i=0; i < goodArgsList.length; i++) {
try {
logger.log(Level.FINEST, "Trying good args: {0}",
Arrays.asList(goodArgsList[i]));
SharedActivatableServiceDescriptor tsd =
(SharedActivatableServiceDescriptor)
cons.newInstance(goodArgsList[i]);
if (!checkMainArgs(goodArgsList[i], tsd)) {
throw new TestException(
"Failed -- check main args");
}
if (!checkRestart((Boolean)goodArgsList[i][8], tsd)) {
throw new TestException(
"Failed -- check restart flag");
}
if (!checkInnerProxyPreparer((ProxyPreparer)goodArgsList[i][6], tsd)) {
throw new TestException(
"Failed -- check inner proxy preparer");
}
if (!checkServicePreparer((ProxyPreparer)goodArgsList[i][7], tsd)) {
throw new TestException(
"Failed -- check service proxy preparer");
}
if (!checkHost((String)goodArgsList[i][9], tsd)) {
throw new TestException(
"Failed -- check activation host");
}
if (!checkPort((Integer)goodArgsList[i][10], tsd)) {
throw new TestException(
"Failed -- check activation port");
}
} catch (Exception e) {
throw new TestException(
"Failed -- failed good args: ["
+ i + "] ", e);
}
}
// Excercise alternate constructor
consArgs = new Class[] {
String.class, String.class, String.class, String.class,
String.class, String[].class, boolean.class, String.class,
int.class};
cons = null;
cons = SharedActivatableServiceDescriptor.class.getConstructor(
consArgs);
logger.log(Level.FINEST,
"Trying constructor that takes the following args: {0}",
Arrays.asList(consArgs));
//Test bad args
ArrayList list = new ArrayList();
for (int i=0; i < badArgsList.length; i++) {
try {
list.clear();
list.add(0, badArgsList[i][0]);
list.add(1, badArgsList[i][1]);
list.add(2, badArgsList[i][2]);
list.add(3, badArgsList[i][3]);
list.add(4, badArgsList[i][4]);
list.add(5, badArgsList[i][5]);
list.add(6, badArgsList[i][8]);
list.add(7, badArgsList[i][9]);
list.add(8, badArgsList[i][10]);
logger.log(Level.FINEST, "Trying bad args: {0}", list);
cons.newInstance(list.toArray());
throw new TestException(
"Failed -- took bad args: " + i);
} catch (java.lang.reflect.InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof NullPointerException) {
logger.log(Level.FINEST,
"Got expected NullPointerException", t);
} else {
logger.log(Level.FINEST,
"Got unexpected Exception", t);
throw e;
}
}
}
for (int i=0; i < goodArgsList.length; i++) {
try {
list.clear();
list.add(0, goodArgsList[i][0]);
list.add(1, goodArgsList[i][1]);
list.add(2, goodArgsList[i][2]);
list.add(3, goodArgsList[i][3]);
list.add(4, goodArgsList[i][4]);
list.add(5, goodArgsList[i][5]);
list.add(6, goodArgsList[i][8]);
list.add(7, goodArgsList[i][9]);
list.add(8, goodArgsList[i][10]);
logger.log(Level.FINEST, "Trying good args: {0}", list);
Object[] args = list.toArray();
SharedActivatableServiceDescriptor tsd =
(SharedActivatableServiceDescriptor)
cons.newInstance(args);
if (!checkMainArgs(args, tsd)) {
throw new TestException(
"Failed -- check main args");
}
if (!checkRestart((Boolean)args[6], tsd)) {
throw new TestException(
"Failed -- check restart flag");
}
if (!checkHost((String)args[7], tsd)) {
throw new TestException(
"Failed -- check activation host");
}
if (!checkPort((Integer)args[8], tsd)) {
throw new TestException(
"Failed -- check activation port");
}
} catch (Exception e) {
throw new TestException(
"Failed -- failed good args: ["
+ i + "] ", e);
}
}
// Excercise alternate constructor
consArgs = new Class[] {
String.class, String.class, String.class, String.class,
String.class, String[].class, ProxyPreparer.class,
ProxyPreparer.class, boolean.class};
cons = null;
cons = SharedActivatableServiceDescriptor.class.getConstructor(
consArgs);
logger.log(Level.FINEST,
"Trying constructor that takes the following args: {0}",
Arrays.asList(consArgs));
//Test bad args
list = new ArrayList();
for (int i=0; i < badArgsList.length; i++) {
try {
list.clear();
list.add(0, badArgsList[i][0]);
list.add(1, badArgsList[i][1]);
list.add(2, badArgsList[i][2]);
list.add(3, badArgsList[i][3]);
list.add(4, badArgsList[i][4]);
list.add(5, badArgsList[i][5]);
list.add(6, badArgsList[i][6]);
list.add(7, badArgsList[i][7]);
list.add(8, badArgsList[i][8]);
logger.log(Level.FINEST, "Trying bad args: {0}", list);
cons.newInstance(list.toArray());
throw new TestException(
"Failed -- took bad args: " + i);
} catch (java.lang.reflect.InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof NullPointerException) {
logger.log(Level.FINEST,
"Got expected NullPointerException", t);
} else {
logger.log(Level.FINEST,
"Got unexpected Exception", t);
throw e;
}
}
}
for (int i=0; i < goodArgsList.length; i++) {
try {
list.clear();
list.add(0, goodArgsList[i][0]);
list.add(1, goodArgsList[i][1]);
list.add(2, goodArgsList[i][2]);
list.add(3, goodArgsList[i][3]);
list.add(4, goodArgsList[i][4]);
list.add(5, goodArgsList[i][5]);
list.add(6, goodArgsList[i][6]);
list.add(7, goodArgsList[i][7]);
list.add(8, goodArgsList[i][8]);
logger.log(Level.FINEST, "Trying good args: {0}", list);
Object[] args = list.toArray();
SharedActivatableServiceDescriptor tsd =
(SharedActivatableServiceDescriptor)
cons.newInstance(args);
if (!checkMainArgs(args, tsd)) {
throw new TestException(
"Failed -- check main args");
}
if (!checkRestart((Boolean)args[8], tsd)) {
throw new TestException(
"Failed -- check restart flag");
}
if (!checkInnerProxyPreparer((ProxyPreparer)args[6], tsd)) {
throw new TestException(
"Failed -- check inner proxy preparer");
}
if (!checkServicePreparer((ProxyPreparer)args[7], tsd)) {
throw new TestException(
"Failed -- check service proxy preparer");
} } catch (Exception e) {
throw new TestException(
"Failed -- failed good args: ["
+ i + "] ", e);
}
}
// Excercise alternate constructor
consArgs = new Class[] {
String.class, String.class, String.class, String.class,
String.class, String[].class, boolean.class};
cons = null;
cons = SharedActivatableServiceDescriptor.class.getConstructor(
consArgs);
logger.log(Level.FINEST,
"Trying constructor that takes the following args: {0}",
Arrays.asList(consArgs));
//Test bad args
list = new ArrayList();
for (int i=0; i < badArgsList.length; i++) {
try {
list.clear();
list.add(0, badArgsList[i][0]);
list.add(1, badArgsList[i][1]);
list.add(2, badArgsList[i][2]);
list.add(3, badArgsList[i][3]);
list.add(4, badArgsList[i][4]);
list.add(5, badArgsList[i][5]);
list.add(6, badArgsList[i][8]);
logger.log(Level.FINEST, "Trying bad args: {0}", list);
cons.newInstance(list.toArray());
throw new TestException(
"Failed -- took bad args: " + i);
} catch (java.lang.reflect.InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof NullPointerException) {
logger.log(Level.FINEST,
"Got expected NullPointerException", t);
} else {
logger.log(Level.FINEST,
"Got unexpected Exception", t);
throw e;
}
}
}
for (int i=0; i < goodArgsList.length; i++) {
try {
list.clear();
list.add(0, goodArgsList[i][0]);
list.add(1, goodArgsList[i][1]);
list.add(2, goodArgsList[i][2]);
list.add(3, goodArgsList[i][3]);
list.add(4, goodArgsList[i][4]);
list.add(5, goodArgsList[i][5]);
list.add(6, goodArgsList[i][8]);
logger.log(Level.FINEST, "Trying good args: {0}", list);
Object[] args = list.toArray();
SharedActivatableServiceDescriptor tsd =
(SharedActivatableServiceDescriptor)
cons.newInstance(args);
if (!checkMainArgs(args, tsd)) {
throw new TestException(
"Failed -- check main args");