01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. The ASF licenses this file to You
04: * under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License. For additional information regarding
15: * copyright in this work, please see the NOTICE file in the top level
16: * directory of this distribution.
17: */
18: package org.apache.roller.webservices.adminapi;
19:
20: import java.io.IOException;
21: import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet;
22: import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
23: import org.jdom.JDOMException;
24:
25: public class MemberHandlerTest extends HandlerBaseTest {
26: public void testHandler() {
27: try {
28: createSampleUser();
29: createSampleWeblog();
30:
31: //create
32: MemberEntrySet mesCreate = createSampleMember();
33: assertNotNull(mesCreate);
34: assertNotNull(mesCreate.getEntries());
35: assertEquals(mesCreate.getEntries().length, 1);
36: assertEquals(mesCreate, getSampleMemberEntrySet());
37:
38: //get
39: MemberEntrySet mesFetch = fetchSampleMember();
40: assertNotNull(mesFetch);
41: assertNotNull(mesFetch.getEntries());
42: assertEquals(mesFetch.getEntries().length, 1);
43: assertEquals(mesFetch, mesCreate);
44:
45: //update
46: MemberEntrySet mesUpdate = updateSampleMember();
47: assertNotNull(mesUpdate);
48: assertNotNull(mesUpdate.getEntries());
49: assertEquals(mesUpdate.getEntries().length, 1);
50: assertEquals(
51: mesUpdate,
52: updateSampleMemberEntrySet(getSampleMemberEntrySet()));
53:
54: //delete
55: MemberEntrySet mesDelete = deleteSampleMember(true);
56: assertNotNull(mesDelete);
57: assertNotNull(mesCreate.getEntries());
58: assertEquals(mesCreate.getEntries().length, 1);
59: assertEquals(mesDelete, mesUpdate);
60: } catch (IOException ioe) {
61: ioe.printStackTrace();
62: fail(ioe.getMessage());
63: } catch (JDOMException je) {
64: je.printStackTrace();
65: fail(je.getMessage());
66: } catch (UnexpectedRootElementException uree) {
67: uree.printStackTrace();
68: fail(uree.getMessage());
69: }
70: }
71: }
|