Author: deepal
Date: Mon Jan 14 01:52:35 2008
New Revision: 12199
Log:
adding the test case that Krishnatha has created to test APP
Added:
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/UserTest.java
Modified:
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
Modified:
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
==============================================================================
---
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
(original)
+++
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
Mon Jan 14 01:52:35 2008
@@ -37,8 +37,4 @@
}
}
-
- public void testResourceRename() throws Exception {
- super.testResourceRename();
- }
}
Added:
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/UserTest.java
==============================================================================
--- (empty file)
+++
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/UserTest.java
Mon Jan 14 01:52:35 2008
@@ -0,0 +1,98 @@
+/*
+ * 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.wso2.registry.app;
+
+import junit.framework.TestCase;
+import org.wso2.registry.Registry;
+import org.wso2.registry.RegistryException;
+import org.wso2.registry.Resource;
+
+import java.net.URL;
+
+public class UserTest extends TestCase {
+
+ RegistryServer server = new RegistryServer();
+
+ public void setUp() {
+ try {
+ if (registry == null) {
+ server.start();
+ registry = new RemoteRegistry(new
URL("http://localhost:8081/wso2registry/atom"), "admin", "admin");
+ }
+ } catch (Exception e) {
+ fail("Failed to initialize the registry.");
+ }
+ }
+
+ private static Registry registry = null;
+
+ public void testAddResouces1() throws Exception {
+ Resource r1 = new Resource();
+ String content = "this is my content1";
+ r1.setContent(content.getBytes());
+ String path = "/c1/r2";
+ try {
+ registry.put(path, r1);
+ } catch (RegistryException e) {
+ fail("Couldn't put content to path c1/r1");
+ }
+
+ }
+
+ public void testAddResouces2() throws Exception {
+ Resource r1 = new Resource();
+ String content = "this is my content2";
+ r1.setContent(content.getBytes());
+ String path = "/c1/r2";
+ try {
+ registry.put(path, r1);
+ } catch (RegistryException e) {
+ fail("Couldn't put content to path c1/r1");
+ }
+
+ }
+
+ public void testViewResource() throws Exception {
+ Resource r1 ;
+ String path = "/c1/r2";
+ try {
+ r1 = registry.get(path);
+ System.out.println(new String((byte[]) r1.getContent()));
+ System.out.println(r1.getAuthorUserName());
+ System.out.println(r1.getCreatedTime());
+ System.out.println(r1.getLastModified());
+ System.out.println(r1.getLastUpdaterUserName());
+
+ } catch (RegistryException e) {
+ fail("Couldn't get content details from path c1/r1");
+ }
+
+ }
+
+ public void testDeleteResources() throws Exception {
+ String path = "/c1/r2";
+ try {
+ registry.delete(path);
+ } catch (RegistryException e) {
+ fail("Couldn't get content details from path c1/r1");
+ }
+ }
+
+}
+
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev