diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/CompilerInterface.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/CompilerInterface.java new file mode 100755 index 00000000..90f20202 --- /dev/null +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/CompilerInterface.java @@ -0,0 +1,35 @@ +package org.springframework.ldap.itest.ad; + +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class CompilerInterface { + // Compile the given file - when we can drop Java 5 we'll use the Java 6 compiler API + public static void compile(String directory, String file) throws Exception { + + ProcessBuilder pb = new ProcessBuilder( + new String[] { "javac", + "-cp", "."+File.pathSeparatorChar+"target"+File.separatorChar+"classes"+ + File.pathSeparatorChar+System.getProperty("java.class.path"), + directory+File.separatorChar+file }); + + pb.redirectErrorStream(true); + Process proc = pb.start(); + InputStream is = proc.getInputStream(); + InputStreamReader isr = new InputStreamReader(is); + + char[] buf = new char[1024]; + int count; + StringBuilder builder = new StringBuilder(); + while ((count = isr.read(buf)) > 0) { + builder.append(buf, 0, count); + } + + boolean ok = proc.waitFor() == 0; + + if (!ok) { + throw new RuntimeException(builder.toString()); + } + } +} diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITest.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITest.java index 31b586db..ace0105c 100755 --- a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITest.java +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITest.java @@ -12,8 +12,6 @@ import org.springframework.ldap.core.DistinguishedName; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.support.LdapContextSource; import org.springframework.ldap.odm.core.impl.OdmManagerImpl; -import org.springframework.ldap.odm.test.TestLdap; -import org.springframework.ldap.odm.test.utils.CompilerInterface; import org.springframework.ldap.odm.tools.SchemaToJava; import org.springframework.ldap.odm.typeconversion.impl.Converter; import org.springframework.ldap.odm.typeconversion.impl.ConverterManagerImpl; @@ -32,7 +30,7 @@ import static org.junit.Assert.assertEquals; // Tests the generation of entry Java classes from LDAP schema public final class SchemaToJavaAdITest { - private static final Log LOG = LogFactory.getLog(TestLdap.class); + private static final Log LOG = LogFactory.getLog(SchemaToJavaAdITest.class); private static final DistinguishedName baseName = new DistinguishedName("dc=261consulting,dc=local");