Browse Source

Some changes to make it easier to run the sample with the database driver as part of the jetty plugin configuration, preventing classloader leaks.

Luke Taylor 16 years ago
parent
commit
331a04c07c

+ 16 - 6
samples/contacts/pom.xml

@@ -66,16 +66,16 @@
             <groupId>net.sf.ehcache</groupId>
             <artifactId>ehcache</artifactId>
         </dependency>
-        <dependency>
-            <groupId>hsqldb</groupId>
-            <artifactId>hsqldb</artifactId>
-            <scope>runtime</scope>
-        </dependency>
         <dependency>
             <groupId>hessian</groupId>
             <artifactId>hessian</artifactId>
             <version>3.0.1</version>
         </dependency>
+        <dependency>
+            <groupId>hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+            <scope>runtime</scope>
+        </dependency>
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
@@ -96,11 +96,21 @@
                 <configuration>
                     <contextPath>/contacts</contextPath>
                     <!--jettyConfig>${basedir}/src/test/resources/jetty.xml</jettyConfig-->
-                    <scanIntervalSeconds>10</scanIntervalSeconds>
+                    <scanIntervalSeconds>5</scanIntervalSeconds>
                     <!--scanTargets>
                         <scanTarget>src/main/webapp/css</scanTarget>
                     </scanTargets-->
                 </configuration>
+<!--
+                <dependencies>
+                    <dependency>
+                        <groupId>hsqldb</groupId>
+                        <artifactId>hsqldb</artifactId>
+                        <version>1.8.0.7</version>
+                        <scope>runtime</scope>
+                    </dependency>
+                </dependencies>
+ -->
             </plugin>
         </plugins>
     </build>

+ 12 - 0
samples/contacts/src/main/java/sample/contact/DataSourcePopulator.java

@@ -76,6 +76,18 @@ public class DataSourcePopulator implements InitializingBean {
                 AuthorityUtils.createAuthorityList("ROLE_IGNORED"));
         SecurityContextHolder.getContext().setAuthentication(authRequest);
 
+        try {
+            template.execute("DROP TABLE CONTACTS");
+            template.execute("DROP TABLE AUTHORITIES");
+            template.execute("DROP TABLE USERS");
+            template.execute("DROP TABLE ACL_ENTRY");
+            template.execute("DROP TABLE ACL_OBJECT_IDENTITY");
+            template.execute("DROP TABLE ACL_CLASS");
+            template.execute("DROP TABLE ACL_SID");
+        } catch(Exception e) {
+            System.out.println("Failed to drop tables: " + e.getMessage());
+        }
+
         template.execute(
             "CREATE TABLE ACL_SID(" +
                     "ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 100) NOT NULL PRIMARY KEY," +