Author: francisdb
Date: Tue Oct 27 22:58:17 2009
New Revision: 830388
URL: http://svn.apache.org/viewvc?rev=830388&view=rev
Log:
added missing apache headers
fix possible test failure because of database file leftovers
Modified:
incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Column.java
incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Database.java
incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Table.java
incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/FileUtils.java
incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/StringUtils.java
incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseTable.vm
incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm
incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Record.vm
incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm
incubator/empire-db/trunk/empire-db/pom.xml
incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/db/hsql/DBDatabaseDriverHSqlTest.java
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Column.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Column.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Column.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Column.java
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.empire.db.codegen.types;
import java.sql.ResultSet;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Database.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Database.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Database.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Database.java
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.empire.db.codegen.types;
import java.sql.Connection;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Table.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Table.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Table.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/types/Table.java
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.empire.db.codegen.types;
import java.sql.DatabaseMetaData;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/FileUtils.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/FileUtils.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/FileUtils.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/FileUtils.java
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.empire.db.codegen.util;
import java.io.BufferedReader;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/StringUtils.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/StringUtils.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/util/StringUtils.java
Tue Oct 27 22:58:17 2009
@@ -1,9 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.empire.db.codegen.util;
public class StringUtils {
/**
* Derives a java class name from a database table name.
- * @param tableName
+ * @param name
* @return
*/
public static String javaClassName(String name) {
@@ -62,7 +80,7 @@
/**
* Derives the mutator method name based on the attribute name.
* @param attribute
- * @return
+ * @return
*/
public static String deriveMutatorName(String attribute) {
StringBuilder sb = new StringBuilder();
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseRecord.vm
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *#
package ${recordPackage};
import org.apache.empire.db.DBRecord;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseTable.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseTable.vm?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseTable.vm
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/BaseTable.vm
Tue Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *#
package $tablePackageName;
import org.apache.empire.db.DBDatabase;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm (original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm Tue
Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *#
package $basePackageName;
import java.sql.Connection;
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Record.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Record.vm?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Record.vm (original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Record.vm Tue
Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *#
package ${recordPackage};
#if ($table.hasBigDecimalField())
Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm (original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm Tue
Oct 27 22:58:17 2009
@@ -1,3 +1,21 @@
+#*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *#
package $tablePackageName;
import org.apache.empire.data.DataType;
Modified: incubator/empire-db/trunk/empire-db/pom.xml
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/pom.xml?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/pom.xml (original)
+++ incubator/empire-db/trunk/empire-db/pom.xml Tue Oct 27 22:58:17 2009
@@ -35,10 +35,17 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
+ <!-- TEST -->
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/db/hsql/DBDatabaseDriverHSqlTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/db/hsql/DBDatabaseDriverHSqlTest.java?rev=830388&r1=830387&r2=830388&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/db/hsql/DBDatabaseDriverHSqlTest.java
(original)
+++ incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/db/hsql/DBDatabaseDriverHSqlTest.java
Tue Oct 27 22:58:17 2009
@@ -22,11 +22,14 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.io.File;
+import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Date;
+import org.apache.commons.io.FileUtils;
import org.apache.empire.db.CompanyDB;
import org.apache.empire.db.DBCmdType;
import org.apache.empire.db.DBDatabaseDriver;
@@ -40,14 +43,19 @@
public class DBDatabaseDriverHSqlTest
{
+ private static final String PATH = "target/hsqldb-unit-test/";
+
public static CompanyDB db;
public static Connection conn;
@BeforeClass
- public static void setup() throws ClassNotFoundException, SQLException{
+ public static void setup() throws ClassNotFoundException, SQLException, IOException{
+ // clean up possible previous test files
+ FileUtils.deleteDirectory(new File(PATH));
+
Class.forName("org.hsqldb.jdbcDriver");
conn = DriverManager.getConnection("jdbc:hsqldb:"
- + "target/hsqldb-unit-test/", // filenames
+ + PATH, // filenames
"sa", // username
""); // password
DBDatabaseDriver driver = new DBDatabaseDriverHSql();
@@ -61,7 +69,7 @@
}
@AfterClass
- public static void shutdown() throws SQLException{
+ public static void shutdown() throws SQLException, IOException{
try{
DBSQLScript script = new DBSQLScript();
db.getDriver().getDDLScript(DBCmdType.DROP, db.EMPLOYEE, script);
@@ -69,7 +77,10 @@
script.run(db.getDriver(), conn, true);
}finally{
DBTools.close(conn);
+ // clean up
+ FileUtils.deleteDirectory(new File(PATH));
}
+
}
@Test
|