IDEMPIERE-92 - Integrate Selenium. Moved project 'idempiere.zk.selenium'

This commit is contained in:
Heng Sin Low 2012-12-13 02:00:09 +08:00
parent a5adac4806
commit 748ed726b4
24 changed files with 407 additions and 28 deletions

View File

@ -1,4 +1,4 @@
!1 Welcome to !-GlobalQSS-! !-ADempiere-! [[FitNesse][FitNesse.FitNesse]]! !1 Welcome to !-iDempiere-! [[FitNesse][FitNesse.FitNesse]]!
!3 ''The fully integrated stand-alone acceptance testing framework and wiki.'' !3 ''The fully integrated stand-alone acceptance testing framework and wiki.''
# Here is a good place to add your first page (WikiWord). For example, MyTopLevelApplicationPage # Here is a good place to add your first page (WikiWord). For example, MyTopLevelApplicationPage
@ -7,6 +7,10 @@ Suites:
IdempiereSuite IdempiereSuite
AvgCostSuite AvgCostSuite
Zk Examples:
ZkSingleClientLogin
ZkMultiClientLogin
| '''To Learn More...'''| | '''To Learn More...'''|
| [[A One-Minute Description][FitNesse.UserGuide.OneMinuteDescription]]|''What is [[FitNesse][FitNesse.FitNesse]]? Start here.''| | [[A One-Minute Description][FitNesse.UserGuide.OneMinuteDescription]]|''What is [[FitNesse][FitNesse.FitNesse]]? Start here.''|

View File

@ -1,4 +1,10 @@
|||01:35:08 mié, nov 28, 2012| |FitLibraryWeb||01:41:13 Thu, Dec 13, 2012|
|FitLibrary||01:40:51 Thu, Dec 13, 2012|
|FrontPage||01:40:10 Thu, Dec 13, 2012|
|FrontPage.ZkMultiClientLogin||01:36:38 Thu, Dec 13, 2012|
|FrontPage.ZkSingleClientLogin||01:32:27 Thu, Dec 13, 2012|
|FrontPage.ZkLogin||24:39:17 Thu, Dec 13, 2012|
|||14:45:31 Wed, Dec 12, 2012|
|CommonTests.CreateMaterialReceipt||01:36:56 mar, abr 03, 2012| |CommonTests.CreateMaterialReceipt||01:36:56 mar, abr 03, 2012|
|CommonTests.CreateProductPrice||01:29:57 mar, abr 03, 2012| |CommonTests.CreateProductPrice||01:29:57 mar, abr 03, 2012|
|AvgCostSuite.BasicTest||01:18:34 mar, abr 03, 2012| |AvgCostSuite.BasicTest||01:18:34 mar, abr 03, 2012|
@ -18,7 +24,6 @@
|CommonTests.SetRandomName||24:14:15 mar, abr 03, 2012| |CommonTests.SetRandomName||24:14:15 mar, abr 03, 2012|
|CommonTests.ValidateClientSetOnAvgInv||24:14:09 mar, abr 03, 2012| |CommonTests.ValidateClientSetOnAvgInv||24:14:09 mar, abr 03, 2012|
|CommonTests.LoginGardenAdmin||24:14:01 mar, abr 03, 2012| |CommonTests.LoginGardenAdmin||24:14:01 mar, abr 03, 2012|
|FrontPage||24:12:35 mar, abr 03, 2012|
|CommonTests||23:24:23 lun, abr 02, 2012| |CommonTests||23:24:23 lun, abr 02, 2012|
|AvgCostSuite.CreateProduct||23:14:23 lun, abr 02, 2012| |AvgCostSuite.CreateProduct||23:14:23 lun, abr 02, 2012|
|AvgCostSuite.ValidateClientSetOnAvgInv||23:10:02 lun, abr 02, 2012| |AvgCostSuite.ValidateClientSetOnAvgInv||23:10:02 lun, abr 02, 2012|

View File

@ -1,8 +1,8 @@
Define the global path: Define the global path:
Where to find the fixtures classes: ( i.e. /home/hengsin/workspace/idempiere/fitnesse/bin ) Where to find the fixtures classes: ( i.e. /home/hengsin/workspace/idempiere-trekglobal/fitnesse/bin )
!define fitnesse_home {/home/carlos/hgAdempiere/localosgi/fitnesse} !define fitnesse_home {/home/hengsin/workspace/idempiere-trekglobal/fitnesse}
!path ${fitnesse_home}/fitnesse.jar:${fitnesse_home}/lib/*.jar:${fitnesse_home}/bin !path ${fitnesse_home}/fitnesse.jar:${fitnesse_home}/lib/*.jar:${fitnesse_home}/bin
@ -16,7 +16,7 @@ There are some important variables here:
This variables can be redefined specifically at page level. This variables can be redefined specifically at page level.
!define TEST_RUNNER {fitnesse.client.FitServerServletInvoker} !define TEST_RUNNER {fitnesse.client.FitServerServletInvoker}
!define COMMAND_PATTERN {java -Xms32m -Xmx512m -DLOG4J_LEVEL=CONFIG -cp %p %m http://localhost:8082/fitnesse/FitServlet} !define COMMAND_PATTERN {java -Xms32m -Xmx512m -DLOG4J_LEVEL=CONFIG -cp %p %m http://localhost:8080/fitnesse/FitServlet}
To enable remote debugging the tests will stop until you connect remotely via eclipse using RemoteADempiereFitnesse.launch To enable remote debugging the tests will stop until you connect remotely via eclipse using RemoteADempiereFitnesse.launch

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.fitnesse.fixture.factory"> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.fitnesse.fixture.fit.factory">
<implementation class="org.idempiere.fitnesse.fixture.FitFixtureFactory"/> <implementation class="org.idempiere.fitnesse.fixture.FitFixtureFactory"/>
<service> <service>
<provide interface="org.idempiere.fitnesse.server.fit.IFitFixtureFactory"/> <provide interface="org.idempiere.fitnesse.server.fit.IFitFixtureFactory"/>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.fitnesse.fixture"> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.fitnesse.fixture.slim.factory">
<implementation class="org.idempiere.fitnesse.fixture.SlimFixtureFactory"/> <implementation class="org.idempiere.fitnesse.fixture.SlimFixtureFactory"/>
<service> <service>
<provide interface="org.idempiere.fitnesse.server.slim.ISlimFixtureFactory"/> <provide interface="org.idempiere.fitnesse.server.slim.ISlimFixtureFactory"/>

View File

@ -15,7 +15,6 @@ package org.idempiere.fitnesse.fixture;
import org.idempiere.fitnesse.server.fit.IFitFixtureFactory; import org.idempiere.fitnesse.server.fit.IFitFixtureFactory;
import fit.Fixture;
import fit.FixtureName; import fit.FixtureName;
/** /**
@ -37,10 +36,10 @@ public class FitFixtureFactory implements IFitFixtureFactory {
* @see org.idempiere.fitnesse.server.fit.IFixtureFactory#getFixture(FixtureName) * @see org.idempiere.fitnesse.server.fit.IFixtureFactory#getFixture(FixtureName)
*/ */
@Override @Override
public Fixture getFixture(FixtureName fixtureName) { public Object getFixture(FixtureName fixtureName) {
String className = fixtureName.toString(); String className = fixtureName.toString();
try { try {
Class<Fixture> clazz = (Class<Fixture>) getClass().getClassLoader().loadClass(className); Class<?> clazz = getClass().getClassLoader().loadClass(className);
return clazz.newInstance(); return clazz.newInstance();
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
} catch (InstantiationException e) { } catch (InstantiationException e) {
@ -50,7 +49,7 @@ public class FitFixtureFactory implements IFitFixtureFactory {
if (!fixtureName.isFullyQualified()) { if (!fixtureName.isFullyQualified()) {
className = DEFAULT_PACKAGE + "." + fixtureName.toString(); className = DEFAULT_PACKAGE + "." + fixtureName.toString();
try { try {
Class<Fixture> clazz = (Class<Fixture>) getClass().getClassLoader().loadClass(className); Class<?> clazz = getClass().getClassLoader().loadClass(className);
return clazz.newInstance(); return clazz.newInstance();
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
} catch (InstantiationException e) { } catch (InstantiationException e) {

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="selenium-server-standalone-2.27.0.jar"/>
<classpathentry exported="true" kind="lib" path="fitlibraryweb-2.0.jar" sourcepath="fitlibrarywebSrc-2.0.zip"/>
<classpathentry exported="true" kind="lib" path="log4j-1.2.16.jar"/>
<classpathentry exported="true" kind="lib" path="fitlibrary-2.0.jar" sourcepath="fitlibrarySrc-2.0.zip"/>
<classpathentry exported="true" kind="lib" path="fitnesse.jar" sourcepath="fitnesse-sources.jar"/> <classpathentry exported="true" kind="lib" path="fitnesse.jar" sourcepath="fitnesse-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View File

@ -11,15 +11,192 @@ Import-Package: javax.servlet;version="3.0.0",
org.adempiere.base, org.adempiere.base,
org.osgi.framework;version="1.3.0" org.osgi.framework;version="1.3.0"
Bundle-ClassPath: ., Bundle-ClassPath: .,
fitnesse.jar fitlibrary-2.0.jar,
fitnesse.jar,
log4j-1.2.16.jar,
fitlibraryweb-2.0.jar,
selenium-server-standalone-2.27.0.jar
Web-ContextPath: fitnesse Web-ContextPath: fitnesse
Export-Package: fit, Export-Package: fit,
fit.decorator, fit.decorator,
fit.decorator.exceptions, fit.decorator.exceptions,
fit.decorator.performance, fit.decorator.performance,
fit.decorator.util, fit.decorator.util,
fit.eg,
fit.eg.bowling,
fit.eg.bowling.fixtures,
fit.exception, fit.exception,
fit.specify,
fit.testFxtr, fit.testFxtr,
fitbook,
fitbook.accounts,
fitbook.chat,
fitbook.items,
fitbook.money,
fitbook.sokoban,
fitlibrary,
fitlibrary.aboutToBeRemoved,
fitlibrary.annotation,
fitlibrary.batch,
fitlibrary.batch.fitnesseIn,
fitlibrary.batch.resultsOut,
fitlibrary.batch.testRun,
fitlibrary.batch.trinidad,
fitlibrary.clean,
fitlibrary.closure,
fitlibrary.collection,
fitlibrary.collection.array,
fitlibrary.collection.list,
fitlibrary.collection.map,
fitlibrary.collection.set,
fitlibrary.config,
fitlibrary.database,
fitlibrary.date,
fitlibrary.debug,
fitlibrary.definedAction,
fitlibrary.definedactions,
fitlibrary.diff,
fitlibrary.differences,
fitlibrary.domainAdapter,
fitlibrary.dynamicVariable,
fitlibrary.eg,
fitlibrary.eg.chat,
fitlibrary.email,
fitlibrary.exception,
fitlibrary.exception.classes,
fitlibrary.exception.method,
fitlibrary.exception.parse,
fitlibrary.exception.table,
fitlibrary.flex,
fitlibrary.flow,
fitlibrary.flow.actor,
fitlibrary.ftp,
fitlibrary.global,
fitlibrary.http,
fitlibrary.listener,
fitlibrary.log,
fitlibrary.matcher,
fitlibrary.mockWebServices,
fitlibrary.mockWebServices.clock,
fitlibrary.mockWebServices.logger,
fitlibrary.mockWebServices.requestMatcher,
fitlibrary.mockWebServices.responder,
fitlibrary.mockWebServices.specify,
fitlibrary.mockWebServices.term,
fitlibrary.mockWebServices.transactionFixture,
fitlibrary.object,
fitlibrary.parser,
fitlibrary.parser.collection,
fitlibrary.parser.graphic,
fitlibrary.parser.lookup,
fitlibrary.parser.self,
fitlibrary.parser.table,
fitlibrary.parser.tagged,
fitlibrary.parser.tree,
fitlibrary.pdf,
fitlibrary.polling,
fitlibrary.ref,
fitlibrary.runResults,
fitlibrary.runner,
fitlibrary.runtime,
fitlibrary.selenium,
fitlibrary.server,
fitlibrary.service,
fitlibrary.sh,
fitlibrary.sh.utility,
fitlibrary.spec,
fitlibrary.spec.filter,
fitlibrary.spec.matcher,
fitlibrary.special,
fitlibrary.speciallyNamedPackage,
fitlibrary.specify,
fitlibrary.specify.access,
fitlibrary.specify.arrayParser,
fitlibrary.specify.autowrap,
fitlibrary.specify.calculate,
fitlibrary.specify.collection,
fitlibrary.specify.collectionSetUp,
fitlibrary.specify.constraint,
fitlibrary.specify.definedAction,
fitlibrary.specify.domain,
fitlibrary.specify.dynamicVariable,
fitlibrary.specify.eg,
fitlibrary.specify.entityParser,
fitlibrary.specify.exception,
fitlibrary.specify.global,
fitlibrary.specify.initialClass,
fitlibrary.specify.listParser,
fitlibrary.specify.log,
fitlibrary.specify.mapParser,
fitlibrary.specify.mapTraverse,
fitlibrary.specify.missingMethod,
fitlibrary.specify.missingProperty,
fitlibrary.specify.parser,
fitlibrary.specify.plugin,
fitlibrary.specify.select,
fitlibrary.specify.set,
fitlibrary.specify.setParser,
fitlibrary.specify.specialAction,
fitlibrary.specify.specialisedTables,
fitlibrary.specify.suite,
fitlibrary.specify.utility,
fitlibrary.specify.valueObject,
fitlibrary.specify.workflow,
fitlibrary.spider,
fitlibrary.spider.component,
fitlibrary.spider.driver,
fitlibrary.spider.element,
fitlibrary.spider.polling,
fitlibrary.spider.specify,
fitlibrary.spider.utility,
fitlibrary.suite,
fitlibrary.table,
fitlibrary.tableOnParse,
fitlibrary.tableProxy,
fitlibrary.template,
fitlibrary.template.specify,
fitlibrary.traverse,
fitlibrary.traverse.function,
fitlibrary.traverse.workflow,
fitlibrary.traverse.workflow.caller,
fitlibrary.traverse.workflow.definedAction,
fitlibrary.traverse.workflow.special,
fitlibrary.tutorial,
fitlibrary.tutorial.chat,
fitlibrary.typed,
fitlibrary.utility,
fitlibrary.utility.option,
fitlibrary.ws,
fitlibrary.ws.client,
fitlibrary.ws.clock,
fitlibrary.ws.logger,
fitlibrary.ws.message,
fitlibrary.ws.mock.logger,
fitlibrary.ws.mock.requestMatcher,
fitlibrary.ws.mock.responder,
fitlibrary.ws.mock.term,
fitlibrary.ws.recorder,
fitlibrary.ws.soap,
fitlibrary.xml,
fitlibrary.xml.specify,
fitlibrary.xref,
fitlibraryGeneric,
fitlibraryGeneric.eg.rentEz,
fitlibraryGeneric.generic,
fitlibraryGeneric.list,
fitlibraryGeneric.map,
fitlibraryGeneric.object,
fitlibraryGeneric.set,
fitlibraryGeneric.specify,
fitlibraryGeneric.specify.calculate,
fitlibraryGeneric.specify.collections,
fitlibraryGeneric.specify.enumerator,
fitlibraryGeneric.specify.genericFinder,
fitlibraryGeneric.specify.object,
fitlibraryGeneric.specify.unbound,
fitlibraryGeneric.specify.workflow,
fitlibraryGeneric.traverse,
fitlibraryGeneric.typed,
fitnesse, fitnesse,
fitnesse.authentication, fitnesse.authentication,
fitnesse.components, fitnesse.components,
@ -60,4 +237,91 @@ Export-Package: fit,
fitnesseMain, fitnesseMain,
fitnesseMain.ant, fitnesseMain.ant,
org.idempiere.fitnesse.server.fit, org.idempiere.fitnesse.server.fit,
org.idempiere.fitnesse.server.slim org.idempiere.fitnesse.server.slim,
org.openqa.grid.common,
org.openqa.grid.common.exception,
org.openqa.grid.internal,
org.openqa.grid.internal.exception,
org.openqa.grid.internal.listeners,
org.openqa.grid.internal.utils,
org.openqa.grid.selenium,
org.openqa.grid.selenium.proxy,
org.openqa.grid.selenium.utils,
org.openqa.grid.web,
org.openqa.grid.web.servlet,
org.openqa.grid.web.servlet.beta,
org.openqa.grid.web.servlet.handler,
org.openqa.grid.web.utils,
org.openqa.jetty.html,
org.openqa.jetty.http,
org.openqa.jetty.http.ajp,
org.openqa.jetty.http.ajp.jmx,
org.openqa.jetty.http.handler,
org.openqa.jetty.http.handler.jmx,
org.openqa.jetty.http.jmx,
org.openqa.jetty.http.nio,
org.openqa.jetty.jetty,
org.openqa.jetty.jetty.jmx,
org.openqa.jetty.jetty.servlet,
org.openqa.jetty.jetty.servlet.jmx,
org.openqa.jetty.jetty.win32,
org.openqa.jetty.log,
org.openqa.jetty.servlet,
org.openqa.jetty.start,
org.openqa.jetty.stop,
org.openqa.jetty.util,
org.openqa.jetty.util.jmx,
org.openqa.jetty.xml,
org.openqa.selenium,
org.openqa.selenium.android,
org.openqa.selenium.browserlaunchers,
org.openqa.selenium.browserlaunchers.locators,
org.openqa.selenium.chrome,
org.openqa.selenium.firefox,
org.openqa.selenium.firefox.internal,
org.openqa.selenium.html5,
org.openqa.selenium.htmlunit,
org.openqa.selenium.ie,
org.openqa.selenium.interactions,
org.openqa.selenium.interactions.internal,
org.openqa.selenium.interactions.touch,
org.openqa.selenium.internal,
org.openqa.selenium.internal.selenesedriver,
org.openqa.selenium.internal.seleniumemulation,
org.openqa.selenium.io,
org.openqa.selenium.iphone,
org.openqa.selenium.lift,
org.openqa.selenium.lift.find,
org.openqa.selenium.lift.match,
org.openqa.selenium.logging,
org.openqa.selenium.logging.profiler,
org.openqa.selenium.net,
org.openqa.selenium.os,
org.openqa.selenium.remote,
org.openqa.selenium.remote.html5,
org.openqa.selenium.remote.internal,
org.openqa.selenium.remote.server,
org.openqa.selenium.remote.server.handler,
org.openqa.selenium.remote.server.handler.html5,
org.openqa.selenium.remote.server.handler.interactions,
org.openqa.selenium.remote.server.handler.interactions.touch,
org.openqa.selenium.remote.server.handler.internal,
org.openqa.selenium.remote.server.renderer,
org.openqa.selenium.remote.server.resource,
org.openqa.selenium.remote.server.rest,
org.openqa.selenium.remote.server.xdrpc,
org.openqa.selenium.remote.service,
org.openqa.selenium.safari,
org.openqa.selenium.security,
org.openqa.selenium.server,
org.openqa.selenium.server.browserlaunchers,
org.openqa.selenium.server.cli,
org.openqa.selenium.server.commands,
org.openqa.selenium.server.htmlrunner,
org.openqa.selenium.server.log,
org.openqa.selenium.support,
org.openqa.selenium.support.events,
org.openqa.selenium.support.events.internal,
org.openqa.selenium.support.pagefactory,
org.openqa.selenium.support.pagefactory.internal,
org.openqa.selenium.support.ui

View File

@ -2,4 +2,8 @@ source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
fitnesse.jar fitnesse.jar,\
fitlibrary-2.0.jar,\
log4j-1.2.16.jar,\
fitlibraryweb-2.0.jar,\
selenium-server-standalone-2.27.0.jar

View File

@ -7,6 +7,7 @@ import fitnesse.slim.converters.*;
import java.beans.PropertyEditorManager; import java.beans.PropertyEditorManager;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.*; import java.util.*;
import org.adempiere.base.Service; import org.adempiere.base.Service;
@ -141,9 +142,52 @@ public class StatementExecutor implements StatementExecutorInterface {
} }
} }
Class<?> k = searchPathsForClass(className);
Constructor<?> constructor = getConstructor(k.getConstructors(), args);
if (constructor == null)
throw new SlimError(String.format("message:<<NO_CONSTRUCTOR %s>>", className));
Object newInstance = constructor.newInstance(ConverterSupport.convertArgs(args, constructor
.getParameterTypes()));
if (newInstance instanceof StatementExecutorConsumer) {
((StatementExecutorConsumer) newInstance).setStatementExecutor(this);
}
return newInstance;
}
private Class<?> searchPathsForClass(String className) {
Class<?> k = getClass(className);
if (k != null)
return k;
List<String> reversedPaths = new ArrayList<String>(paths);
Collections.reverse(reversedPaths);
for (String path : reversedPaths) {
k = getClass(path + "." + className);
if (k != null)
return k;
}
throw new SlimError(String.format("message:<<NO_CLASS %s>>", className)); throw new SlimError(String.format("message:<<NO_CLASS %s>>", className));
} }
private Class<?> getClass(String className) {
try {
return getClass().getClassLoader().loadClass(className);
} catch (ClassNotFoundException e) {
return null;
}
}
private Constructor<?> getConstructor(Constructor<?>[] constructors, Object[] args) {
for (Constructor<?> constructor : constructors) {
Class<?> arguments[] = constructor.getParameterTypes();
if (arguments.length == args.length)
return constructor;
}
return null;
}
public Object call(String instanceName, String methodName, Object... args) { public Object call(String instanceName, String methodName, Object... args) {
try { try {
return getMethodExecutionResult(instanceName, methodName, args).returnValue(); return getMethodExecutionResult(instanceName, methodName, args).returnValue();

View File

@ -5,6 +5,7 @@ import org.idempiere.fitnesse.server.Runner;
import fit.Counts; import fit.Counts;
import fit.FitServer; import fit.FitServer;
import fitlibrary.suite.FitLibraryServer;
/** /**
* Adapted from http://sourceforge.net/projects/patang/ * Adapted from http://sourceforge.net/projects/patang/
@ -19,8 +20,16 @@ class FitServerRunner extends Runner {
@Override @Override
protected Counts run(String[] params) throws Exception { protected Counts run(String[] params) throws Exception {
FitServer fitServer = new FitServer(); // FitServer fitServer = new FitServer();
MyFitLibraryServer fitServer = new MyFitLibraryServer();
fitServer.run(params); fitServer.run(params);
// fitServer.run(params);
return fitServer.getCounts(); return fitServer.getCounts();
} }
class MyFitLibraryServer extends FitLibraryServer {
public Counts getCounts() {
return suiteTestResults.getCounts();
}
}
} }

View File

@ -13,7 +13,6 @@
*****************************************************************************/ *****************************************************************************/
package org.idempiere.fitnesse.server.fit; package org.idempiere.fitnesse.server.fit;
import fit.Fixture;
import fit.FixtureName; import fit.FixtureName;
/** /**
@ -28,5 +27,5 @@ public interface IFitFixtureFactory {
* @param fixtureName * @param fixtureName
* @return Fixture * @return Fixture
*/ */
public Fixture getFixture(FixtureName fixtureName); public Object getFixture(FixtureName fixtureName);
} }

View File

@ -13,13 +13,16 @@
*****************************************************************************/ *****************************************************************************/
package org.idempiere.fitnesse.server.fit; package org.idempiere.fitnesse.server.fit;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.adempiere.base.Service; import org.adempiere.base.Service;
import fit.Fixture; import fit.Fixture;
import fit.FixtureClass;
import fit.FixtureLoader; import fit.FixtureLoader;
import fit.FixtureName; import fit.FixtureName;
import fit.exception.CouldNotLoadComponentFitFailureException;
import fit.exception.NoSuchFixtureException; import fit.exception.NoSuchFixtureException;
/** /**
@ -38,10 +41,43 @@ public class OSGiFixtureLoader extends FixtureLoader {
FixtureName fixtureName = new FixtureName(className); FixtureName fixtureName = new FixtureName(className);
List<IFitFixtureFactory> factories = Service.locator().list(IFitFixtureFactory.class).getServices(); List<IFitFixtureFactory> factories = Service.locator().list(IFitFixtureFactory.class).getServices();
for(IFitFixtureFactory factory : factories) { for(IFitFixtureFactory factory : factories) {
Fixture fixture = factory.getFixture(fixtureName); Object fixture = factory.getFixture(fixtureName);
if (fixture != null) if (fixture != null && fixture instanceof Fixture)
return fixture; return (Fixture) fixture;
} }
Fixture fixture = instantiateFirstValidFixtureClass(fixtureName);
return fixture;
}
private Fixture instantiateFixture(String fixtureName) throws Throwable {
Class<?> classForFixture = loadFixtureClass(fixtureName);
FixtureClass fixtureClass = new FixtureClass(classForFixture);
return fixtureClass.newInstance();
}
private Class<?> loadFixtureClass(String fixtureName) {
try {
return getClass().getClassLoader().loadClass(fixtureName);
} catch (ClassNotFoundException deadEnd) {
if (deadEnd.getMessage().equals(fixtureName))
throw new NoSuchFixtureException(fixtureName);
throw new CouldNotLoadComponentFitFailureException(
deadEnd.getMessage(), fixtureName);
}
}
private Fixture instantiateFirstValidFixtureClass(FixtureName fixtureName)
throws Throwable {
for (Iterator<String> i = fixtureName.getPotentialFixtureClassNames(
fixturePathElements).iterator(); i.hasNext();) {
String each = i.next();
try {
return instantiateFixture(each);
} catch (NoSuchFixtureException ignoreAndTryTheNextCandidate) {
//
}
}
throw new NoSuchFixtureException(fixtureName.toString()); throw new NoSuchFixtureException(fixtureName.toString());
} }
} }

View File

@ -2,6 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/selenium-server-standalone-2.27.0.jar" sourcepath="lib/selenium-server-2.27.0-srcs.jar"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -5,13 +5,24 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -7,7 +7,7 @@ import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.SearchContext; import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement; import org.openqa.selenium.internal.WrapsDriver;
/** /**
* utility class to find elements using zk jq selector * utility class to find elements using zk jq selector
@ -37,10 +37,10 @@ public class Zk {
if (context instanceof WebDriver) { if (context instanceof WebDriver) {
executor = (JavascriptExecutor) context; executor = (JavascriptExecutor) context;
} else { } else {
RemoteWebElement element = (RemoteWebElement) context; WebElement element = (WebElement) context;
String id = element.getAttribute("id"); String id = element.getAttribute("id");
selector = "#"+id+" "+selector; selector = "#"+id+" "+selector;
executor = (JavascriptExecutor) element.getWrappedDriver(); executor = (JavascriptExecutor) ((WrapsDriver)element).getWrappedDriver();
} }
List<WebElement> list = (List<WebElement>) executor.executeScript("return jq('" + selector + "').get();"); List<WebElement> list = (List<WebElement>) executor.executeScript("return jq('" + selector + "').get();");
return list; return list;

View File

@ -2,6 +2,6 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/idempiere.zk.selenium/lib/selenium-server-standalone-2.27.0.jar" sourcepath="/idempiere.zk.selenium/lib/selenium-server-2.27.0-srcs.jar"/> <classpathentry kind="lib" path="/org.idempiere.fitnesse.server/selenium-server-standalone-2.27.0.jar" sourcepath="/idempiere.zk.selenium/lib/selenium-server-2.27.0-srcs.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -2,7 +2,7 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/idempiere.zk.selenium/lib/selenium-server-standalone-2.27.0.jar" sourcepath="/idempiere.zk.selenium/lib/selenium-server-2.27.0-srcs.jar"/> <classpathentry kind="lib" path="/org.idempiere.fitnesse.server/selenium-server-standalone-2.27.0.jar" sourcepath="/idempiere.zk.selenium/lib/selenium-server-2.27.0-srcs.jar"/>
<classpathentry kind="lib" path="lib/ztl-2.0.0-SNAPSHOT.jar"/> <classpathentry kind="lib" path="lib/ztl-2.0.0-SNAPSHOT.jar" sourcepath="lib/ztl-2.0.0-sources.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>