1 package org.apache.commons.jcs3.auxiliary.remote.server;
2
3 import org.apache.commons.jcs3.auxiliary.remote.server.behavior.RemoteType;
4
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 */
23
24 import junit.framework.TestCase;
25
26 /**
27 * Tests for the remote cache server attributes.
28 */
29 public class RemoteCacheServerAttributesUnitTest
30 extends TestCase
31 {
32
33 /**
34 * Verify that we get a string, even if not attributes are set.
35 */
36 public void testToString()
37 {
38 final RemoteCacheServerAttributes attributes = new RemoteCacheServerAttributes();
39 assertNotNull( "Should have a string.", attributes.toString() );
40 }
41
42 /**
43 * Verify that the type is set correctly and that the correct name is returned for the type.
44 */
45 public void testSetRemoteTypeName_local()
46 {
47 final RemoteCacheServerAttributes attributes = new RemoteCacheServerAttributes();
48 attributes.setRemoteTypeName( "LOCAL" );
49 assertEquals( "Wrong type.", RemoteType.LOCAL, attributes.getRemoteType() );
50 assertEquals( "Wrong name", "LOCAL", attributes.getRemoteTypeName() );
51 }
52
53 /**
54 * Verify that the type is set correctly and that the correct name is returned for the type.
55 */
56 public void testSetRemoteTypeName_cluster()
57 {
58 final RemoteCacheServerAttributes attributes = new RemoteCacheServerAttributes();
59 attributes.setRemoteTypeName( "CLUSTER" );
60 assertEquals( "Wrong type.", RemoteType.CLUSTER, attributes.getRemoteType() );
61 assertEquals( "Wrong name", "CLUSTER", attributes.getRemoteTypeName() );
62 }
63 }