KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > system > metadata > depends > test > DependsUnitTestCase


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.system.metadata.depends.test;
23
24 import javax.management.ObjectName JavaDoc;
25
26 import org.jboss.system.metadata.ServiceMetaData;
27 import org.jboss.test.system.metadata.test.AbstractMetaDataTest;
28
29 /**
30  * DependsUnitTestCase.
31  *
32  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
33  * @version $Revision: 1.1 $
34  */

35 public class DependsUnitTestCase extends AbstractMetaDataTest
36 {
37    public DependsUnitTestCase(String JavaDoc name)
38    {
39       super(name);
40    }
41
42    public void testDependsNone() throws Exception JavaDoc
43    {
44       dependsNone();
45    }
46
47    public void testDependsOne() throws Exception JavaDoc
48    {
49       dependsOne();
50    }
51
52    public void testDependsTwo() throws Exception JavaDoc
53    {
54       dependsTwo();
55    }
56
57    public void testDependsNestedMBean() throws Exception JavaDoc
58    {
59       dependsOne();
60    }
61
62    // @review shouldn't an empty depends-list be an error?
63
public void testDependsListNone() throws Exception JavaDoc
64    {
65       dependsNone();
66    }
67
68    public void testDependsListOne() throws Exception JavaDoc
69    {
70       dependsOne();
71    }
72
73    public void testDependsListTwo() throws Exception JavaDoc
74    {
75       dependsTwo();
76    }
77
78    public void testDependsListNestedMBean() throws Exception JavaDoc
79    {
80       dependsOne();
81    }
82
83    protected void dependsNone() throws Exception JavaDoc
84    {
85       ServiceMetaData metaData = unmarshalSingleMBean();
86       assertNoDependencies(metaData);
87       assertOthers(metaData);
88    }
89
90    protected void dependsOne() throws Exception JavaDoc
91    {
92       ServiceMetaData metaData = unmarshalSingleMBean();
93       ObjectName JavaDoc[] expected = { TEST1 };
94       assertDependencies(metaData, expected);
95       assertOthers(metaData);
96    }
97
98    protected void dependsTwo() throws Exception JavaDoc
99    {
100       ServiceMetaData metaData = unmarshalSingleMBean();
101       ObjectName JavaDoc[] expected = { TEST1, TEST2 };
102       assertDependencies(metaData, expected);
103       assertOthers(metaData);
104    }
105
106    protected void assertOthers(ServiceMetaData metaData) throws Exception JavaDoc
107    {
108       assertEquals(testBasicMBeanName, metaData.getObjectName());
109       assertEquals(testBasicMBeanCode, metaData.getCode());
110       assertNull(metaData.getInterfaceName());
111       assertDefaultConstructor(metaData);
112       assertNoAttributes(metaData);
113       assertNoXMBean(metaData);
114    }
115 }
116
Popular Tags