You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2011/12/19 18:18:29 UTC

svn commit: r1220855 - /incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java

Author: lahiru
Date: Mon Dec 19 17:18:28 2011
New Revision: 1220855

URL: http://svn.apache.org/viewvc?rev=1220855&view=rev
Log:
adding registry restart test.

Added:
    incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java

Added: incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java?rev=1220855&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java (added)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/test/java/org/apache/airavata/registry/api/impl/JCRRegistryRestartTest.java Mon Dec 19 17:18:28 2011
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.registry.api.impl;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.jackrabbit.core.RepositoryFactoryImpl;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.apache.xmlbeans.XmlString;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryFactory;
+import javax.jcr.Session;
+
+import static org.junit.Assert.fail;
+
+public class JCRRegistryRestartTest {
+    @Test
+       public void testJCRRegistryRestart() {
+           try {
+               /*
+                * Create database
+                */
+               JCRRegistry jcrRegistry = new JCRRegistry(null, "org.apache.jackrabbit.core.RepositoryFactoryImpl",
+                       "admin", "admin", null);
+
+               String hostId = "localhost";
+               String address = "127.0.0.1";
+               /*
+                * Host
+                */
+               HostDescription host = new HostDescription();
+               host.getType().setHostName(hostId);
+               host.getType().setHostAddress(address);
+
+               jcrRegistry.saveHostDescription(host);
+
+               Repository repository = jcrRegistry.getRepository();
+               ((TransientRepository)repository).shutdown();
+
+
+               HostDescription hostR = jcrRegistry.getHostDescription(hostId);
+               Assert.assertNotNull(hostR);
+           } catch (Exception e) {
+               e.printStackTrace();
+               fail(e.getMessage());
+           }
+       }
+
+}