summaryrefslogtreecommitdiffstats
path: root/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java')
-rw-r--r--feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java
new file mode 100644
index 00000000..b58c22c6
--- /dev/null
+++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchemaTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * feature-session-persistence
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.drools.persistence;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.junit.Test;
+
+/**
+ * Generates the schema DDL files.
+ */
+public class GenSchemaTest {
+
+ private EntityManagerFactory emf;
+
+
+ /*
+ * This is a JUnit which is provided as a utility for producing a basic
+ * ddl schema file in the sql directory.
+ *
+ * To run this simple add @Test ahead of the method and then run this
+ * as a JUnit.
+ */
+ public void generate() throws Exception {
+ Map<String, Object> propMap = new HashMap<>();
+
+ propMap.put("javax.persistence.jdbc.driver", "org.h2.Driver");
+ propMap.put("javax.persistence.jdbc.url",
+ "jdbc:h2:mem:JpaDroolsSessionConnectorTest");
+
+ emf = Persistence.createEntityManagerFactory(
+ "schemaDroolsPU", propMap);
+
+ emf.close();
+ }
+}