KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > system > metadata > value > AbstractValueTest


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.value;
23
24 import java.util.List JavaDoc;
25
26 import org.jboss.system.metadata.ServiceAttributeMetaData;
27 import org.jboss.system.metadata.ServiceMetaData;
28 import org.jboss.system.metadata.ServiceValueMetaData;
29 import org.jboss.test.system.metadata.test.AbstractMetaDataTest;
30
31 /**
32  * AbstractValueTest.
33  *
34  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
35  * @version $Revision: 1.1 $
36  */

37 public abstract class AbstractValueTest extends AbstractMetaDataTest
38 {
39    public AbstractValueTest(String JavaDoc name)
40    {
41       super(name);
42    }
43
44    protected ServiceAttributeMetaData unmarshallSingleAttribute() throws Exception JavaDoc
45    {
46       ServiceMetaData metaData = unmarshalSingleMBean();
47       assertOthers(metaData);
48       List JavaDoc<ServiceAttributeMetaData> attributes = metaData.getAttributes();
49       assertNotNull(attributes);
50       assertEquals(1, attributes.size());
51       return attributes.get(0);
52    }
53
54    protected ServiceValueMetaData unmarshallSingleValue() throws Exception JavaDoc
55    {
56       ServiceMetaData metaData = unmarshalSingleMBean();
57       assertOthers(metaData);
58       List JavaDoc<ServiceAttributeMetaData> attributes = metaData.getAttributes();
59       assertNotNull(attributes);
60       assertEquals(1, attributes.size());
61       ServiceAttributeMetaData attribute = attributes.get(0);
62       assertAttributeName(attribute, "Attribute");
63       ServiceValueMetaData result = attribute.getValue();
64       assertNotNull(result);
65       return result;
66    }
67
68    protected void assertOthers(ServiceMetaData metaData) throws Exception JavaDoc
69    {
70       assertEquals(testBasicMBeanName, metaData.getObjectName());
71       assertEquals(testBasicMBeanCode, metaData.getCode());
72       assertNull(metaData.getInterfaceName());
73       assertDefaultConstructor(metaData);
74       assertNoXMBean(metaData);
75    }
76 }
77
Popular Tags