I created scripted dataset in Birt (4.4.0) along with a Event Handler:
public class ActionsPerDateDataSet extends ScriptedDataSetEventAdapter {
#Override
public boolean fetch( IDataSetInstance dataSet, IUpdatableDataSetRow row ) throws ScriptException {
}
#Override
public void open(IDataSetInstance dataSet) {
}
}
I generate the report using the following code:
public File actionPdf() throws EngineException, IOException {
IReportEngine engine = getEngine();
IReportRunnable design = engine.openReportDesign("c:\\...\\scripted.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
// Set parent classloader for engine
task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, ReportingService.class.getClassLoader());
File f = new File(System.nanoTime() + "res.pdf");
final IRenderOption options = new RenderOption();
options.setOutputFormat("pdf");
OutputStream os = new FileOutputStream(f);
options.setOutputStream(os);
task.setRenderOption(options);
task.run();
task.close();
os.close();
return f;
}
However Birt can't find the class:
Caused by: java.lang.ClassNotFoundException: com.foo.aip.ejb.reporting.action.ActionsPerDateDataSet
at org.eclipse.birt.core.framework.URLClassLoader.findClass1(URLClassLoader.java:188)
at org.eclipse.birt.core.framework.URLClassLoader$1.run(URLClassLoader.java:156)
at org.eclipse.birt.core.framework.URLClassLoader$1.run(URLClassLoader.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.core.framework.URLClassLoader.findClass(URLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.birt.report.engine.executor.ApplicationClassLoader.loadClass(ApplicationClassLoader.java:79)
at org.eclipse.birt.report.engine.executor.EventHandlerManager.loadClass(EventHandlerManager.java:99)
... 85 more
I am out of ideas :(
Do you have any hints for me?
The classloader should be set when the engine is initialized, use an object of type org.eclipse.birt.report.engine.api.EngineConfig
EngineConfig config = new EngineConfig();
config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,ReportingService.class.getClassLoader());
Of course this will work only if "ReportingService" class is in the same classloader than "ActionsPerDateDataSet" but you don't provide informations about that. If it is not the case, set a further classloader to the BIRT engine with
config.setProperty( EngineConstants.WEBAPP_CLASSPATH_KEY,"c:/your-jar-location/actionperdataset.jar;c:/your-class-location" );
Related
I wanted to create a simple template wizard for NetBeans that would take an existing Java class from current user project and create a new Java class from it. To do so, I need to access field and annotation data from the selected class (Java file).
Now, I used the org.netbeans.api.java.source.ui.TypeElementFinder for finding and selecting the wanted class, but as a result I get an ElementHandle and I don't know what to do with it. How do I get class info from this?
I managed to get a TypeMirror (com.sun.tools.javac.code.Type$ClassType) using this code snippet:
Project project = ...; // from Templates.getProject(WizardDescriptor);
ClasspathInfo ci = ClasspathInfoFactory.infoFor(project, true, true, true);
final ElementHandle<TypeElement> element = TypeElementFinder.find(ci);
FileObject fo = SourceUtils.getFile(element, ci);
JavaSource.forFileObject(fo).runUserActionTask(new Task<CompilationController>() {
#Override
public void run(CompilationController p) throws Exception {
p.toPhase(JavaSource.Phase.RESOLVED);
TypeElement typeElement = element.resolve(p);
TypeMirror typeMirror = typeElement.asType();
}
}, true);
But what to do form here? Am I going about this the wrong way altogether?
EDIT:
In, response to francesco foresti's post:
I tried loads of different Reflection/Classloader approaches. I got to a point where a org.netbeans.api.java.classpath.ClassPath instance was created and would contain the wanted Class file, but when I tried loading the said class with a Classloader created from that ClassPath, I would get a ClassNotFoundException. Here's my code:
Project project = ...; // from Templates.getProject(WizardDescriptor);
ClasspathInfo ci = ClasspathInfoFactory.infoFor(project, true, true, true);
final ElementHandle<TypeElement> element = TypeElementFinder.find(ci);
FileObject fo = SourceUtils.getFile(element, ci);
ClassPath cp = ci.getClassPath(ClasspathInfo.PathKind.SOURCE);
System.out.println("NAME: " + element.getQualifiedName());
System.out.println("CONTAINS: " + cp.contains(fo));
try {
Class clazz = Class.forName(element.getQualifiedName(), true, cp.getClassLoader(true));
System.out.println(clazz.getName());
} catch (ClassNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
This yields:
NAME: hr.test.Test
CONTAINS: true
SEVERE [org.openide.util.Exceptions]
java.lang.ClassNotFoundException: hr.test.Test
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at org.openide.execution.NbClassLoader.findClass(NbClassLoader.java:210)
at org.netbeans.api.java.classpath.ClassLoaderSupport.findClass(ClassLoaderSupport.java:113)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
why don't you use plain old reflection? E.g.
Class<?> theClazz = Class.forName("com.example.myClass");
Annotation[] annotations = theClazz.getAnnotations();
Field[] fields = theClazz.getFields();
Method[] methods = theClazz.getMethods();
// from here on, you write a file that happens to be in the classpath,
// and whose extension is '.java'
I am learning the Luaj library and I am trying to implement the hyperbolic example in a unit test:
#Test
public void testHyperbolicLuaScriptExample() throws Exception {
URL luaScriptUrl = Thread.currentThread().getContextClassLoader().getResource("hyperbolic.lua");
Assert.assertNotNull(luaScriptUrl);
String luaScriptUrlPath = luaScriptUrl.getPath();
File luaScriptFile = new File(luaScriptUrlPath);
FileInputStream luaScriptFileInputStream = new FileInputStream(luaScriptFile);
Prototype luaScriptPrototype = LuaC.instance.compile(luaScriptFileInputStream, "");
Globals luaScriptStandardGlobals = JsePlatform.standardGlobals();
LuaClosure luaClosure = new LuaClosure(luaScriptPrototype, luaScriptStandardGlobals);
LuaValue luaValue = luaClosure.call();
}
hyperbolic.java is constructed as per the example
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.*;
public class hyperbolic extends TwoArgFunction {
public hyperbolic() {}
public LuaValue call(LuaValue moduleName, LuaValue environment) {
LuaValue library = tableOf();
library.set("sinh", new sinh());
library.set("cosh", new cosh());
environment.set("com.apple.aide.lua.hyperbolic", library);
return library;
}
static class sinh extends OneArgFunction {
public LuaValue call(LuaValue x) {
return LuaValue.valueOf(Math.sinh(x.checkdouble()));
}
}
static class cosh extends OneArgFunction {
public LuaValue call(LuaValue x) {
return LuaValue.valueOf(Math.cosh(x.checkdouble()));
}
}
}
And the in hyberbolic.lua
require 'hyperbolic'
return {"x", hyperbolic.sinh(0.5), "y", hyperbolic.cosh(0.5)}
However the test produces the following error
org.luaj.vm2.LuaError: #hyperbolic.lua:3 loop or previous error loading module 'hyperbolic'
at org.luaj.vm2.LuaValue.error(Unknown Source)
at org.luaj.vm2.lib.PackageLib$require.call(Unknown Source)
at org.luaj.vm2.LuaClosure.execute(Unknown Source)
at org.luaj.vm2.LuaClosure.call(Unknown Source)
at org.luaj.vm2.lib.PackageLib$require.call(Unknown Source)
at org.luaj.vm2.LuaClosure.execute(Unknown Source)
at org.luaj.vm2.LuaClosure.call(Unknown Source)
at com.example.LuaScriptExecutionTest.testHyperbolicLuaScriptExample(LuaScriptExecutionTest.java:52)
What does this error mean and how do I fix it?
And the in hyberbolic.lua (sic, should be hyperbolic)
require 'hyperbolic'
You require a module with the same name as the file in which require happens, which leads to a loop (that's what the error message is about). Simply rename the current file (hyperbolic.lua) and the error should go away.
Background :
I started playing with Groovy recently and am trying to embed a groovy script engine in an eclipse plugin to let my customers develop their own GUI extensions inside my eclipse-based product. This is very similar to the success story published on codehaus's website.
Problem
The groovy script (let's call it "main_eclipse.groovy") run from the eclipse plugin by a GroovyScriptEngine throws when trying to load a groovy class ("SwtGuiBuilder"), with the following error :
BUG! Queuing new source whilst already iterating. Queued source is 'file:/home/nicolas/workspace/groovy-test/src/gui/SwtGuiBuilder.groovy'
Question
Did anyone run into the same problem ? How can it be fixed ?
Any help will be highly appreciated !
Some observations :
When using the groovy interpreter instead of a GroovyScriptEngine java object, I have no problem using my SwtGuiBuilder class (see script "main_groovy" here below).
My problem does not seem to be a classpath issue, since the file containing my SwtGuiBuilder class is mentioned in the thrown exception.
The error message is mentioned in two reported groovy bugs, GRECLIPSE-429 and GRECLIPSE-1037. I did not fully get the technicals details, but those bugs seemed to be related to performance issues when loading lots of classes, which is not relevant in my situation...
Details
SampleView.java
public class SampleView
{
public SampleView() { super(); }
public void createPartControl(Composite parent)
{
String groovyScript = null;
String [] groovyPath = null;
boolean shall_exit = false;
do
{ // ask user for params
GroovyLocationDialog groovyLocationDialog= new GroovyLocationDialog(parent.getShell() );
int return_code = groovyLocationDialog.open();
if ( return_code != Window.OK )
shall_exit = true;
else
{
groovyScript= groovyLocationDialog.getInputScriptName();
groovyPath = groovyLocationDialog.getInputScriptPath();
// run it
ScriptConnector scriptConnector = new ScriptConnector(parent);
try { scriptConnector.runGuiComponentScript( groovyPath, groovyScript); }
catch (Exception e) { e.printStackTrace(); }
System.out.println("script finished");
}
}
while ( ! shall_exit );
}
ScriptConnector.java
public class ScriptConnector
{
private String[] roots;
private Composite window;
private Binding binding;
public ScriptConnector( Composite window )
{
this.window = window;
Binding scriptenv = new Binding(); // A new Binding is created ...
scriptenv.setVariable("SDE", this);
scriptenv.setVariable("WINDOW", this.window); // ref to current window
this.binding = scriptenv;
}
public void runGuiComponentScript(final String[] groovyPath, final String scriptName)
{
GroovyScriptEngine gse = null;
this.roots = groovyPath;
try
{
// instanciating the script engine with current classpath
gse = new GroovyScriptEngine( roots, this.getClass().getClassLoader() );
gse.run(scriptName, binding); // ... and run specified script
}
catch (Exception e) { e.printStackTrace(); }
catch (Throwable t) { t.printStackTrace(); }
}
}
main_eclipse.groovy
package launcher;
import org.eclipse.swt.SWT
import org.eclipse.swt.widgets.*
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.RowLayout as Layout
// This import will fail...
import gui.SwtGuiBuilder;
WINDOW.layout = new Layout(SWT.VERTICAL);
def builder = new SwtGuiBuilder(WINDOW);
builder.Label ( style=SWT.NONE, text = 'Simple demo of Groovy and SWT')
builder.Button( style=SWT.PUSH, text = 'Click me' , action = { println "Click !" } )
SwtGuiBuilder.groovy
package gui;
import org.eclipse.swt.events.*
import org.eclipse.swt.widgets.Button
import org.eclipse.swt.widgets.Composite
import org.eclipse.swt.widgets.Label
class SwtGuiBuilder
{
private Composite _parent
public SwtGuiBuilder(Composite parent) { _parent = parent }
public void Button( style = SWT.PUSH, text= null, action = null )
{
def btn = new Button(_parent, style)
if ( text != null )
btn.text = text
if (action != null)
btn.addSelectionListener( new SelectionAdapter() { void widgetSelected( SelectionEvent event ) { action(); } } );
}
public void Label( style = SWT.NONE, text = '' )
{
def lbl = new Label(_parent, style)
lbl.text = text
}
}
main_groovy.groovy
package launcher;
import org.eclipse.swt.SWT
import org.eclipse.swt.widgets.*
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.RowLayout as Layout
// ... But this import is handled properly !
import gui.SwtGuiBuilder;
def display = new Display()
def WINDOW = new Shell(display)
WINDOW.text = 'Groovy / SWT Test';
WINDOW.layout = new Layout(SWT.VERTICAL);
def builder = new SwtGuiBuilder(WINDOW);
builder.Label ( style=SWT.NONE, text = 'Simple demo of Groovy and SWT')
builder.Button( style=SWT.PUSH, text = 'Click me' , action = { println "Ya clicked me !" } )
WINDOW.pack();
WINDOW.open();
while (!WINDOW.disposed) {
if (!WINDOW.display.readAndDispatch())
WINDOW.display.sleep();
}
Stack trace
BUG! Queuing new source whilst already iterating. Queued source is 'file:/home/nicolas/workspace/groovy-test/src/gui/SwtGuiBuilder.groovy'
at org.codehaus.groovy.control.CompilationUnit.addSource(CompilationUnit.java:460)
at org.codehaus.groovy.control.CompilationUnit.addSource(CompilationUnit.java:433)
at groovy.util.GroovyScriptEngine$ScriptClassLoader$3.findClassNode(GroovyScriptEngine.java:195)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:124)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:863)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:377)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1407)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:202)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:713)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:1015)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:647)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:596)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at groovy.util.GroovyScriptEngine$ScriptClassLoader.doParseClass(GroovyScriptEngine.java:247)
at groovy.util.GroovyScriptEngine$ScriptClassLoader.parseClass(GroovyScriptEngine.java:229)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202)
at groovy.util.GroovyScriptEngine.loadScriptByName(GroovyScriptEngine.java:514)
at groovy.util.GroovyScriptEngine.createScript(GroovyScriptEngine.java:564)
at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:551)
My configuration :
Linux Ubuntu 14.04 x86
Groovy Version: 2.3.2
JVM: 1.7.0_55
Eclipse Kepler SR2 - Build 20140224-0627
Eclipse Groovy plugin v2.0.7
Instead of GroovyScriptEngine, I've used the GroovyShell class (groovy code below but easy enough to change back to java), CompilerConfiguration allows you to specify the classpath.
def config = new CompilerConfiguration(classpath: classpath)
def binding = new Binding()
def result = new GroovyShell(binding, config).evaluate("""
def foo='bar'
""")
I am using ICEPDF to show and print a PDF doc within my Java Application.
I get the following exception:
org.icepdf.core.pobjects.Catalog <clinit>
INFO: ICEsoft ICEpdf Core 4.1.4
Exception in thread "Thread-4" java.lang.ArrayIndexOutOfBoundsException: 0
at org.icepdf.ri.common.PrintHelper.getSetupDialog(PrintHelper.java:526)
at org.icepdf.ri.common.PrintHelper.setupPrintService(PrintHelper.java:199)
at org.icepdf.ri.common.SwingController.initialisePrinting(SwingController.java:2590)
at org.icepdf.ri.common.SwingController.access$400(SwingController.java:102)
at org.icepdf.ri.common.SwingController$3.run(SwingController.java:2548)
at java.lang.Thread.run(Thread.java:680)
The code I am using is:
public class ViewerComponentExample {
public static void main(String[] args) {
// Get a file from the command line to open
String filePath = "boll.pdf";
// build a component controller
SwingController controller = new SwingController();
SwingViewBuilder factory = new SwingViewBuilder(controller);
JPanel viewerComponentPanel = factory.buildViewerPanel();
// add interactive mouse link annotation support via callback
controller.getDocumentViewController().setAnnotationCallback(
new org.icepdf.ri.common.MyAnnotationCallback(
controller.getDocumentViewController()));
JFrame applicationFrame = new JFrame();
applicationFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
applicationFrame.getContentPane().add(viewerComponentPanel);
// Now that the GUI is all in place, we can try openning a PDF
controller.openDocument(filePath);
// show the component
applicationFrame.pack();
applicationFrame.setVisible(true);
}
}
The above shows the viewer fine and it allows all operations apart from printing! (see exception above).
Any help is highly appreciated.
Thanks
Unfortunatly, this exception appears when no printer is available on you OS.
Here is the icepdf source code:
return ServiceUI.printDialog(graphicsConfiguration,
point.x,
point.y,
services, services[0],
DocFlavor.SERVICE_FORMATTED.PRINTABLE,
printRequestAttributeSet);
"services" is defined like this:
private PrintService[] lookForPrintServices() {
PrintService[] services = PrintServiceLookup.lookupPrintServices(
DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
if (defaultService != null && services.length > 1) {
PrintService printService;
for (int i = 1, max = services.length; i < max; i++) {
printService = services[i];
if (printService.equals(defaultService)) {
PrintService tmp = services[0];
services[0] = defaultService;
services[i] = tmp;
break;
}
}
}
return services;
}
If no services match, the "services" array is zero-length:
http://docs.oracle.com/javase/6/docs/api/javax/print/PrintServiceLookup.html#lookupPrintServices(javax.print.DocFlavor, javax.print.attribute.AttributeSet)
Maybe a solution would be to create a "/dev/null" printer. I don't know how if this is easy to do...
I'm trying to run an embedded ApacheDS in my application. After reading http://directory.apache.org/apacheds/1.5/41-embedding-apacheds-into-an-application.html I build this:
public void startDirectoryService() throws Exception {
service = new DefaultDirectoryService();
service.getChangeLog().setEnabled( false );
Partition apachePartition = addPartition("apache", "dc=apache,dc=org");
addIndex(apachePartition, "objectClass", "ou", "uid");
service.startup();
// Inject the apache root entry if it does not already exist
try
{
service.getAdminSession().lookup( apachePartition.getSuffixDn() );
}
catch ( LdapNameNotFoundException lnnfe )
{
LdapDN dnApache = new LdapDN( "dc=Apache,dc=Org" );
ServerEntry entryApache = service.newEntry( dnApache );
entryApache.add( "objectClass", "top", "domain", "extensibleObject" );
entryApache.add( "dc", "Apache" );
service.getAdminSession().add( entryApache );
}
}
But I can't connect to the server after running it. What is the default port? Or am I missing something?
Here is the solution:
service = new DefaultDirectoryService();
service.getChangeLog().setEnabled( false );
Partition apachePartition = addPartition("apache", "dc=apache,dc=org");
LdapServer ldapService = new LdapServer();
ldapService.setTransports(new TcpTransport(389));
ldapService.setDirectoryService(service);
service.startup();
ldapService.start();
Here is an abbreviated version of how we use it:
File workingDirectory = ...;
Partition partition = new JdbmPartition();
partition.setId(...);
partition.setSuffix(...);
DirectoryService directoryService = new DefaultDirectoryService();
directoryService.setWorkingDirectory(workingDirectory);
directoryService.addPartition(partition);
LdapService ldapService = new LdapService();
ldapService.setSocketAcceptor(new SocketAcceptor(null));
ldapService.setIpPort(...);
ldapService.setDirectoryService(directoryService);
directoryService.startup();
ldapService.start();
I wasn't able to make it run neither with cringe's, Kevin's nor Jörg Pfünder's version. Received constantly NPEs from within my JUnit test. I have debugged that and compiled all of them to a working solution:
public class DirContextSourceAnonAuthTest {
private static DirectoryService directoryService;
private static LdapServer ldapServer;
#BeforeClass
public static void startApacheDs() throws Exception {
String buildDirectory = System.getProperty("buildDirectory");
File workingDirectory = new File(buildDirectory, "apacheds-work");
workingDirectory.mkdir();
directoryService = new DefaultDirectoryService();
directoryService.setWorkingDirectory(workingDirectory);
SchemaPartition schemaPartition = directoryService.getSchemaService()
.getSchemaPartition();
LdifPartition ldifPartition = new LdifPartition();
String workingDirectoryPath = directoryService.getWorkingDirectory()
.getPath();
ldifPartition.setWorkingDirectory(workingDirectoryPath + "/schema");
File schemaRepository = new File(workingDirectory, "schema");
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(
workingDirectory);
extractor.extractOrCopy(true);
schemaPartition.setWrappedPartition(ldifPartition);
SchemaLoader loader = new LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
directoryService.setSchemaManager(schemaManager);
schemaManager.loadAllEnabled();
schemaPartition.setSchemaManager(schemaManager);
List<Throwable> errors = schemaManager.getErrors();
if (!errors.isEmpty())
throw new Exception("Schema load failed : " + errors);
JdbmPartition systemPartition = new JdbmPartition();
systemPartition.setId("system");
systemPartition.setPartitionDir(new File(directoryService
.getWorkingDirectory(), "system"));
systemPartition.setSuffix(ServerDNConstants.SYSTEM_DN);
systemPartition.setSchemaManager(schemaManager);
directoryService.setSystemPartition(systemPartition);
directoryService.setShutdownHookEnabled(false);
directoryService.getChangeLog().setEnabled(false);
ldapServer = new LdapServer();
ldapServer.setTransports(new TcpTransport(11389));
ldapServer.setDirectoryService(directoryService);
directoryService.startup();
ldapServer.start();
}
#AfterClass
public static void stopApacheDs() throws Exception {
ldapServer.stop();
directoryService.shutdown();
directoryService.getWorkingDirectory().delete();
}
#Test
public void anonAuth() throws NamingException {
DirContextSource.Builder builder = new DirContextSource.Builder(
"ldap://localhost:11389");
DirContextSource contextSource = builder.build();
DirContext context = contextSource.getDirContext();
assertNotNull(context.getNameInNamespace());
context.close();
}
}
the 2.x sample is located at folloing link :
http://svn.apache.org/repos/asf/directory/sandbox/kayyagari/embedded-sample-trunk/src/main/java/org/apache/directory/seserver/EmbeddedADSVerTrunk.java
The default port for LDAP is 389.
Since ApacheDS 1.5.7 you will get a NullpointerException. Please use the tutorial at
http://svn.apache.org/repos/asf/directory/documentation/samples/trunk/embedded-sample
This project helped me:
Embedded sample project
I use this dependency in pom.xml:
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-integ</artifactId>
<version>1.5.7</version>
<scope>test</scope>
</dependency>
Further, in 2.0.* the working dir and other paths aren't anymore defined in DirectoryService, but rather in separate class InstanceLayout, which you need to instantiate and then call
InstanceLayout il = new InstanceLayout(BASE_PATH);
directotyService.setInstanceLayout(il);