airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [35/50] [abbrv] git commit: adding app-catalog tests back
Date Tue, 22 Jul 2014 15:06:00 GMT
adding app-catalog tests back


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/cd29e740
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/cd29e740
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/cd29e740

Branch: refs/heads/workflow-support
Commit: cd29e740b051b40b7bd179e4218019850430d12d
Parents: 8edd711
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Mon Jul 21 11:32:51 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Mon Jul 21 11:32:51 2014 -0400

----------------------------------------------------------------------
 .../app/catalog/test/AppDeploymentTest.java     | 147 +++++++++
 .../app/catalog/test/AppInterfaceTest.java      | 173 ++++++++++
 .../app/catalog/test/ComputeResourceTest.java   | 278 ++++++++++++++++
 .../app/catalog/test/GatewayProfileTest.java    | 127 ++++++++
 .../app/catalog/test/util/Initialize.java       | 321 +++++++++++++++++++
 5 files changed, 1046 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/cd29e740/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
new file mode 100644
index 0000000..11e87f9
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
@@ -0,0 +1,147 @@
+/*
+ *
+ * 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.airavata.app.catalog.test;
+
+import org.airavata.appcatalog.cpi.*;
+import org.airavata.appcatalog.cpi.ApplicationDeployment;
+import org.airavata.appcatalog.cpi.ApplicationInterface;
+import org.airavata.appcatalog.cpi.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.aiaravata.application.catalog.data.model.*;
+import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
+import org.apache.airavata.app.catalog.test.util.Initialize;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
+import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertTrue;
+
+public class AppDeploymentTest {
+    private static Initialize initialize;
+    private static AppCatalog appcatalog;
+
+    @Before
+    public void setUp() {
+        try {
+            AiravataUtils.setExecutionAsServer();
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            appcatalog = AppCatalogFactory.getAppCatalog();
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+    }
+
+    @Test
+    public void testAppDeployment () throws Exception {
+        ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
+        ApplicationInterface appInt = appcatalog.getApplicationInterface();
+        ComputeResource computeRs = appcatalog.getComputeResource();
+        ComputeResourceDescription cm = new ComputeResourceDescription();
+        cm.setHostName("localhost");
+        cm.setResourceDescription("test compute host");
+        String hostId = computeRs.addComputeResource(cm);
+
+        ApplicationModule module = new ApplicationModule();
+        module.setAppModuleName("WRF");
+        module.setAppModuleVersion("1.0.0");
+        String wrfModuleId = appInt.addApplicationModule(module);
+
+        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
+        description.setAppModuleId(wrfModuleId);
+        description.setComputeHostId(hostId);
+        description.setExecutablePath("/home/a/b/c");
+        description.setAppDeploymentDescription("test app deployment");
+        description.addToModuleLoadCmds("cmd1");
+        description.addToModuleLoadCmds("cmd2");
+
+        List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();
+        libPrepandPaths.add(createSetEnvPath("name1", "val1"));
+        libPrepandPaths.add(createSetEnvPath("name2", "val2"));
+        description.setLibPrependPaths(libPrepandPaths);
+        List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>();
+        libApendPaths.add(createSetEnvPath("name3", "val3"));
+        libApendPaths.add(createSetEnvPath("name4", "val4"));
+        description.setLibAppendPaths(libApendPaths);
+        List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>();
+        appEvns.add(createSetEnvPath("name5", "val5"));
+        appEvns.add(createSetEnvPath("name6", "val6"));
+        description.setSetEnvironment(appEvns);
+
+        String appDepId = appDep.addApplicationDeployment(description);
+        ApplicationDeploymentDescription app = null;
+        if (appDep.isAppDeploymentExists(appDepId)){
+            app = appDep.getApplicationDeployement(appDepId);
+            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
+        }
+
+        description.setAppDeploymentDescription("test app deployment2");
+        appDep.updateApplicationDeployment(appDepId, description);
+
+        if (appDep.isAppDeploymentExists(appDepId)){
+            app = appDep.getApplicationDeployement(appDepId);
+            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
+        }
+
+        Map<String, String> moduleIdFilter = new HashMap<String, String>();
+        moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId);
+        List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter);
+        System.out.println("******** Size of App deployments for module *********** : " + applicationDeployements.size());
+        Map<String, String> hostFilter = new HashMap<String, String>();
+        hostFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, hostId);
+        List<ApplicationDeploymentDescription> applicationDeployementsForHost = appDep.getApplicationDeployements(hostFilter);
+        System.out.println("******** Size of App deployments for host *********** : " + applicationDeployementsForHost.size());
+
+        List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds();
+        System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size());
+
+        List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements();
+        System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size());
+
+        assertTrue("App interface saved successfully", app != null);
+    }
+
+    public SetEnvPaths createSetEnvPath (String name, String val){
+        SetEnvPaths setEnvPaths = new SetEnvPaths();
+        setEnvPaths.setName(name);
+        setEnvPaths.setValue(val);
+        return setEnvPaths;
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/cd29e740/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
new file mode 100644
index 0000000..a2fdb86
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
@@ -0,0 +1,173 @@
+/*
+ *
+ * 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.airavata.app.catalog.test;
+
+import org.airavata.appcatalog.cpi.AppCatalog;
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.airavata.appcatalog.cpi.ApplicationInterface;
+import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
+import org.apache.airavata.app.catalog.test.util.Initialize;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertTrue;
+
+public class AppInterfaceTest {
+    private static Initialize initialize;
+    private static AppCatalog appcatalog;
+
+    @Before
+    public void setUp() {
+        try {
+            AiravataUtils.setExecutionAsServer();
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            appcatalog = AppCatalogFactory.getAppCatalog();
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+
+    }
+
+    @Test
+    public void testAppInterface(){
+        try {
+            ApplicationInterface appInterface = appcatalog.getApplicationInterface();
+            ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
+            String wrfModuleId = addAppModule("WRF");
+            String amberModuleId = addAppModule("AMBER");
+            List<String> modules = new ArrayList<String>();
+            modules.add(wrfModuleId);
+            modules.add(amberModuleId);
+            InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
+            InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
+            List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
+            inputs.add(appInput1);
+            inputs.add(appInput2);
+            OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
+            OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
+            List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
+            outputs.add(output1);
+            outputs.add(output2);
+            description.setApplicationName("testApplication");
+            description.setApplicationDesription("my testApplication");
+            description.setApplicationModules(modules);
+            description.setApplicationInputs(inputs);
+            description.setApplicationOutputs(outputs);
+            String appID = appInterface.addApplicationInterface(description);
+            System.out.println("********** application id ************* : " + appID);
+            ApplicationInterfaceDescription ainterface = null;
+            if (appInterface.isApplicationInterfaceExists(appID)){
+                ainterface = appInterface.getApplicationInterface(appID);
+                System.out.println("********** application name ************* : " + ainterface.getApplicationName());
+                System.out.println("********** application description ************* : " + ainterface.getApplicationDesription());
+            }
+            ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
+            System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
+            ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
+            System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
+
+            List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
+            System.out.println("********** App Input size ************* : " + applicationInputs.size());
+
+            List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
+            System.out.println("********** App output size ************* : " + applicationOutputs.size());
+
+            description.setApplicationName("testApplication2");
+            appInterface.updateApplicationInterface(appID, description);
+            if (appInterface.isApplicationInterfaceExists(appID)){
+                ainterface = appInterface.getApplicationInterface(appID);
+                System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
+            }
+
+            wrfModule.setAppModuleVersion("1.0.1");
+            appInterface.updateApplicationModule(wrfModuleId, wrfModule);
+            wrfModule = appInterface.getApplicationModule(wrfModuleId);
+            System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
+
+            Map<String, String> filters = new HashMap<String, String>();
+            filters.put(AbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
+            List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
+            System.out.println("********** Size og app interfaces ************* : " + apps.size());
+
+            List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces();
+            System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
+
+            List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
+            System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
+
+            assertTrue("App interface saved successfully", ainterface != null);
+        }catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    public String addAppModule (String moduleName){
+        try {
+            ApplicationModule module = new ApplicationModule();
+            module.setAppModuleName(moduleName);
+            module.setAppModuleVersion("1.0.0");
+            module.setAppModuleDescription("WeatherForcast");
+            return appcatalog.getApplicationInterface().addApplicationModule(module);
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public InputDataObjectType createAppInput (String inputName, String value, DataType type ){
+        InputDataObjectType input = new InputDataObjectType();
+        input.setName(inputName);
+        input.setValue(value);
+        input.setType(type);
+        input.setApplicationArgument("test arg");
+        return input;
+    }
+
+    public OutputDataObjectType createAppOutput (String inputName, String value, DataType type ){
+        OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
+        outputDataObjectType.setName(inputName);
+        outputDataObjectType.setValue(value);
+        outputDataObjectType.setType(type);
+        return outputDataObjectType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/cd29e740/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
new file mode 100644
index 0000000..e0ee1cf
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
@@ -0,0 +1,278 @@
+/*
+ *
+ * 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.airavata.app.catalog.test;
+
+
+import org.airavata.appcatalog.cpi.AppCatalog;
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.airavata.appcatalog.cpi.ComputeResource;
+import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
+import org.apache.airavata.app.catalog.test.util.Initialize;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.computeresource.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.*;
+
+import static org.junit.Assert.assertTrue;
+
+public class ComputeResourceTest {
+    private static Initialize initialize;
+    private static AppCatalog appcatalog;
+
+    @Before
+    public void setUp() {
+        try {
+            AiravataUtils.setExecutionAsServer();
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            appcatalog = AppCatalogFactory.getAppCatalog();
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+
+    }
+
+    @Test
+    public void testAddComputeResource (){
+        try {
+            ComputeResource computeResource = appcatalog.getComputeResource();
+            ComputeResourceDescription description = new ComputeResourceDescription();
+
+            description.setHostName("localhost");
+            description.setResourceDescription("test compute resource");
+            Set<String> ipdaresses = new HashSet<String>();
+            ipdaresses.add("222.33.43.444");
+            ipdaresses.add("23.344.44.454");
+            description.setIpAddresses(ipdaresses);
+            Set<String> aliases = new HashSet<String>();
+            aliases.add("test.alias1");
+            aliases.add("test.alias2");
+            description.setHostAliases(aliases);
+            String sshsubmissionId = addSSHJobSubmission();
+            System.out.println("**** SSH Submission id ****** :" + sshsubmissionId);
+//            String gsiSSHsubmissionId = addGSISSHJobSubmission();
+//            System.out.println("**** GSISSH Submission id ****** :" + gsiSSHsubmissionId);
+//            String globusSubmissionId = addGlobusJobSubmission();
+//            System.out.println("**** Globus Submission id ****** :" + globusSubmissionId);
+            JobSubmissionInterface sshSubmissionInt = new JobSubmissionInterface();
+            sshSubmissionInt.setJobSubmissionInterfaceId(sshsubmissionId);
+            sshSubmissionInt.setPriorityOrder(1);
+            sshSubmissionInt.setJobSubmissionProtocol(JobSubmissionProtocol.SSH);
+            JobSubmissionInterface globusSubInt = new JobSubmissionInterface();
+//            globusSubInt.setJobSubmissionInterfaceId(globusSubmissionId);
+            globusSubInt.setPriorityOrder(2);
+            globusSubInt.setJobSubmissionProtocol(JobSubmissionProtocol.GLOBUS);
+            List<JobSubmissionInterface> interfaceList = new ArrayList<JobSubmissionInterface>();
+            interfaceList.add(sshSubmissionInt);
+            interfaceList.add(globusSubInt);
+            description.setJobSubmissionInterfaces(interfaceList);
+
+            String scpDataMoveId = addSCPDataMovement();
+            System.out.println("**** SCP DataMoveId****** :" + scpDataMoveId);
+            String gridFTPDataMoveId = addGridFTPDataMovement();
+            System.out.println("**** grid FTP DataMoveId****** :" + gridFTPDataMoveId);
+
+            List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
+            DataMovementInterface scpInterface = new DataMovementInterface();
+            scpInterface.setDataMovementInterfaceId(scpDataMoveId);
+            scpInterface.setDataMovementProtocol(DataMovementProtocol.SCP);
+            scpInterface.setPriorityOrder(1);
+
+            DataMovementInterface gridFTPMv = new DataMovementInterface();
+            gridFTPMv.setDataMovementInterfaceId(gridFTPDataMoveId);
+            gridFTPMv.setDataMovementProtocol(DataMovementProtocol.GridFTP);
+            gridFTPMv.setPriorityOrder(2);
+
+            description.setDataMovementInterfaces(dataMovementInterfaces);
+
+            BatchQueue batchQueue1 = new BatchQueue();
+            batchQueue1.setQueueName("queue1");
+            batchQueue1.setQueueDescription("que1Desc1");
+            batchQueue1.setMaxRunTime(10);
+            batchQueue1.setMaxNodes(4);
+            batchQueue1.setMaxJobsInQueue(1);
+
+            BatchQueue batchQueue2 = new BatchQueue();
+            batchQueue2.setQueueName("queue2");
+            batchQueue2.setQueueDescription("que1Desc2");
+            batchQueue2.setMaxRunTime(10);
+            batchQueue2.setMaxNodes(4);
+            batchQueue2.setMaxJobsInQueue(1);
+
+            List<BatchQueue> batchQueueList = new ArrayList<BatchQueue>();
+            batchQueueList.add(batchQueue1);
+            batchQueueList.add(batchQueue2);
+            description.setBatchQueues(batchQueueList);
+
+            Map<FileSystems, String> fileSysMap = new HashMap<FileSystems, String>();
+            fileSysMap.put(FileSystems.HOME, "/home");
+            fileSysMap.put(FileSystems.SCRATCH, "/tmp");
+            description.setFileSystems(fileSysMap);
+
+            String resourceId = computeResource.addComputeResource(description);
+            System.out.println("**********Resource id ************* : " +  resourceId);
+            ComputeResourceDescription host = null;
+            if (computeResource.isComputeResourceExists(resourceId)){
+                host = computeResource.getComputeResource(resourceId);
+                System.out.println("**********Resource name ************* : " +  host.getHostName());
+            }
+
+            SSHJobSubmission sshJobSubmission = computeResource.getSSHJobSubmission(sshsubmissionId);
+            System.out.println("**********SSH Submission resource job manager ************* : " +  sshJobSubmission.getResourceJobManager().toString());
+
+//            GlobusJobSubmission globusJobSubmission = computeResource.get(globusSubmissionId);
+//            System.out.println("**********Globus Submission resource job manager ************* : " + globusJobSubmission.getResourceJobManager().toString());
+
+            SCPDataMovement scpDataMovement = computeResource.getSCPDataMovement(scpDataMoveId);
+            System.out.println("**********SCP Data Move Security protocol ************* : " + scpDataMovement.getSecurityProtocol().toString());
+
+            GridFTPDataMovement gridFTPDataMovement = computeResource.getGridFTPDataMovement(gridFTPDataMoveId);
+            System.out.println("**********GRID FTP Data Move Security protocol ************* : " + gridFTPDataMovement.getSecurityProtocol().toString());
+
+            description.setHostName("localhost2");
+            computeResource.updateComputeResource(resourceId, description);
+            if (computeResource.isComputeResourceExists(resourceId)){
+                host = computeResource.getComputeResource(resourceId);
+                System.out.println("**********Updated Resource name ************* : " +  host.getHostName());
+            }
+
+            Map<String, String> cfilters = new HashMap<String, String>();
+            cfilters.put(AbstractResource.ComputeResourceConstants.HOST_NAME, "localhost2");
+            List<ComputeResourceDescription> computeResourceList = computeResource.getComputeResourceList(cfilters);
+            System.out.println("**********Size of compute resources ************* : " +  computeResourceList.size());
+
+            List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList();
+            System.out.println("**********Size of all compute resources ************* : " +  allComputeResourceList.size());
+
+            Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
+            System.out.println("**********Size of all compute resources ids ************* : " +  allComputeResourceIdList.size());
+
+//            Map<String, String> globusfilters = new HashMap<String, String>();
+//            globusfilters.put(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
+//            List<GlobusJobSubmission> gList = computeResource.getGlobusJobSubmissionList(globusfilters);
+//            System.out.println("**********Size of globus jobs ************* : " +  gList.size());
+
+//            Map<String, String> sshfilters = new HashMap<String, String>();
+//            sshfilters.put(AbstractResource.SSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
+//            List<SSHJobSubmission> sshList = computeResource.getSS(sshfilters);
+//            System.out.println("**********Size of SSH jobs ************* : " + sshList.size());
+
+//            Map<String, String> gsishfilters = new HashMap<String, String>();
+//            gsishfilters.put(AbstractResource.GSISSHSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
+//            List<GSISSHJobSubmission> gsisshList = computeResource.getGSISSHJobSubmissionList(gsishfilters);
+//            System.out.println("**********Size of GSISSH jobs ************* : " + gsisshList.size());
+
+//            Map<String, String> scpfilters = new HashMap<String, String>();
+//            scpfilters.put(AbstractResource.SCPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
+//            List<SCPDataMovement> scpDataMovementList = computeResource.getSCPDataMovementList(scpfilters);
+//            System.out.println("**********Size of SCP DM list ************* : " + scpDataMovementList.size());
+//
+//            Map<String, String> ftpfilters = new HashMap<String, String>();
+//            ftpfilters.put(AbstractResource.GridFTPDataMovementConstants.SECURITY_PROTOCOL, SecurityProtocol.SSH_KEYS.toString());
+//            List<GridFTPDataMovement> ftpDataMovementList = computeResource.getGridFTPDataMovementList(ftpfilters);
+//            System.out.println("**********Size of FTP DM list ************* : " + ftpDataMovementList.size());
+
+            assertTrue("Compute resource save successfully", host != null);
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String addSSHJobSubmission (){
+        try {
+            SSHJobSubmission jobSubmission = new SSHJobSubmission();
+            jobSubmission.setSshPort(22);
+            jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
+            ResourceJobManager jobManager = new ResourceJobManager();
+            jobManager.setResourceJobManagerType(ResourceJobManagerType.PBS);
+            jobManager.setPushMonitoringEndpoint("monitor ep");
+            jobManager.setJobManagerBinPath("/bin");
+            Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
+            commands.put(JobManagerCommand.SUBMISSION, "Sub command");
+            commands.put(JobManagerCommand.SHOW_QUEUE, "show q command");
+            jobManager.setJobManagerCommands(commands);
+//            String jobManagerID = appcatalog.getComputeResource().addResourceJobManager(jobManager);
+//            jobManager.setResourceJobManagerId(jobManagerID);
+            jobSubmission.setResourceJobManager(jobManager);
+            return appcatalog.getComputeResource().addSSHJobSubmission(jobSubmission);
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+//    public String addGlobusJobSubmission (){
+//        try {
+//            GlobusJobSubmission jobSubmission = new GlobusJobSubmission();
+//            jobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
+//            jobSubmission.setResourceJobManager(ResourceJobManager.PBS);
+//            List<String> endPoints = new ArrayList<String>();
+//            endPoints.add("222.33.43.444");
+//            endPoints.add("23.344.44.454");
+//            jobSubmission.setGlobusGateKeeperEndPoint(endPoints);
+//            return appcatalog.getComputeResource().addGlobusJobSubmission(jobSubmission);
+//        } catch (AppCatalogException e) {
+//            e.printStackTrace();
+//        }
+//        return null;
+//    }
+
+    public String addSCPDataMovement (){
+        try {
+            SCPDataMovement dataMovement = new SCPDataMovement();
+            dataMovement.setSshPort(22);
+            dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
+            return appcatalog.getComputeResource().addScpDataMovement(dataMovement);
+        }catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public String addGridFTPDataMovement (){
+        try {
+            GridFTPDataMovement dataMovement = new GridFTPDataMovement();
+            dataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
+            List<String> endPoints = new ArrayList<String>();
+            endPoints.add("222.33.43.444");
+            endPoints.add("23.344.44.454");
+            dataMovement.setGridFTPEndPoints(endPoints);
+            return appcatalog.getComputeResource().addGridFTPDataMovement(dataMovement);
+        }catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/cd29e740/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
new file mode 100644
index 0000000..66eb6bb
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java
@@ -0,0 +1,127 @@
+/*
+ *
+ * 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.airavata.app.catalog.test;
+
+import org.airavata.appcatalog.cpi.AppCatalog;
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.airavata.appcatalog.cpi.ComputeResource;
+import org.airavata.appcatalog.cpi.GwyResourceProfile;
+import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.airavata.app.catalog.test.util.Initialize;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
+import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+public class GatewayProfileTest {
+    private static Initialize initialize;
+    private static AppCatalog appcatalog;
+
+    @Before
+    public void setUp() {
+        try {
+            AiravataUtils.setExecutionAsServer();
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            appcatalog = AppCatalogFactory.getAppCatalog();
+        } catch (AppCatalogException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+    }
+
+    @Test
+    public void gatewayProfileTest() throws Exception {
+        GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
+        GatewayResourceProfile gf = new GatewayResourceProfile();
+        gf.setGatewayName("test");
+        gf.setGatewayDescription("test gateway");
+        ComputeResource computeRs = appcatalog.getComputeResource();
+        ComputeResourceDescription cm1 = new ComputeResourceDescription();
+        cm1.setHostName("localhost");
+        cm1.setResourceDescription("test compute host");
+        String hostId1 = computeRs.addComputeResource(cm1);
+
+        ComputeResourceDescription cm2 = new ComputeResourceDescription();
+        cm2.setHostName("localhost");
+        cm2.setResourceDescription("test compute host");
+        String hostId2 = computeRs.addComputeResource(cm2);
+
+        ComputeResourcePreference preference1 = new ComputeResourcePreference();
+        preference1.setComputeResourceId(hostId1);
+        preference1.setOverridebyAiravata(true);
+        preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH.toString());
+        preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP.toString());
+        preference1.setPreferredBatchQueue("queue1");
+        preference1.setScratchLocation("/tmp");
+        preference1.setAllocationProjectNumber("project1");
+
+        ComputeResourcePreference preference2 = new ComputeResourcePreference();
+        preference2.setComputeResourceId(hostId2);
+        preference2.setOverridebyAiravata(true);
+        preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL.toString());
+        preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP.toString());
+        preference2.setPreferredBatchQueue("queue2");
+        preference2.setScratchLocation("/tmp");
+        preference2.setAllocationProjectNumber("project2");
+
+        List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>();
+        list.add(preference1);
+        list.add(preference2);
+        gf.setComputeResourcePreferences(list);
+
+        String gwId = gatewayProfile.addGatewayResourceProfile(gf);
+        GatewayResourceProfile retrievedProfile = null;
+        if (gatewayProfile.isGatewayResourceProfileExists(gwId)){
+            retrievedProfile = gatewayProfile.getGatewayProfile(gwId);
+            System.out.println("************ gateway name ************** :" + retrievedProfile.getGatewayName());
+        }
+        List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId);
+        System.out.println("compute preferences size : " + preferences.size());
+        if (preferences != null && !preferences.isEmpty()){
+            for (ComputeResourcePreference cm : preferences){
+                System.out.println("******** host id ********* : " + cm.getComputeResourceId());
+                System.out.println(cm.getPreferredBatchQueue());
+                System.out.println(cm.getPreferredDataMovementProtocol());
+                System.out.println(cm.getPreferredJobSubmissionProtocol());
+            }
+        }
+
+        assertTrue("App interface saved successfully", retrievedProfile != null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/cd29e740/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
new file mode 100644
index 0000000..2f68951
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/util/Initialize.java
@@ -0,0 +1,321 @@
+/*
+ *
+ * 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.airavata.app.catalog.test.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class Initialize {
+    private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName = "appcatalog-derby.sql";
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE";
+    private String jdbcUrl = null;
+    private String jdbcDriver = null;
+    private String jdbcUser = null;
+    private String jdbcPassword = null;
+
+    public Initialize(String scriptName) {
+        this.scriptName = scriptName;
+    }
+
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+
+    private static boolean isServerStarted(NetworkServerControl server, int ntries)
+    {
+        for (int i = 1; i <= ntries; i ++)
+        {
+            try {
+                Thread.sleep(500);
+                server.ping();
+                return true;
+            }
+            catch (Exception e) {
+                if (i == ntries)
+                    return false;
+            }
+        }
+        return false;
+    }
+
+    public void initializeDB() {
+
+        try{
+            jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver");
+            jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url");
+            jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user");
+            jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read properties", e);
+        }
+
+        startDerbyInServerMode();
+        if(!isServerStarted(server, 20)){
+           throw new RuntimeException("Derby server cound not started within five seconds...");
+        }
+//      startDerbyInEmbeddedMode();
+
+        Connection conn = null;
+        try {
+            Class.forName(jdbcDriver).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for App Catalog !!!");
+            } else {
+                logger.debug("Database already created for App Catalog!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            try {
+                if (conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error(e.getMessage(), e);
+                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            }
+        }
+    }
+
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+            System.out.println("Running a query to test the database tables existence.");
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void executeSQLScript(Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+
+        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+        reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("//")) {
+                continue;
+            }
+            if (line.startsWith("--")) {
+                continue;
+            }
+            StringTokenizer st = new StringTokenizer(line);
+            if (st.hasMoreTokens()) {
+                String token = st.nextToken();
+                if ("REM".equalsIgnoreCase(token)) {
+                    continue;
+                }
+            }
+            sql.append(" ").append(line);
+
+            // SQL defines "--" as a comment to EOL
+            // and in Oracle it may contain a hint
+            // so we cannot just remove it, instead we must end it
+            if (line.indexOf("--") >= 0) {
+                sql.append("\n");
+            }
+            if ((checkStringBufferEndsWith(sql, delimiter))) {
+                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                sql.replace(0, sql.length(), "");
+            }
+        }
+        // Catch any statements not followed by ;
+        if (sql.length() > 0) {
+            executeSQL(sql.toString(), conn);
+        }
+        }catch (IOException e){
+            logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+        }finally {
+            if (reader != null) {
+                reader.close();
+            }
+
+        }
+
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            logger.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                logger.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    private void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    getPort(jdbcUrl),
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    private void startDerbyInEmbeddedMode(){
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void stopDerbyServer() {
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}


Mime
View raw message