PageRenderTime 48ms CodeModel.GetById 32ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/protocols/ss7/isup/isup-impl/src/test/java/org/mobicents/protocols/ss7/isup/impl/message/parameter/EventInformationTest.java

http://mobicents.googlecode.com/
Java | 82 lines | 28 code | 11 blank | 43 comment | 1 complexity | 1d368abf6996243b0a9fe4e996dfcddc MD5 | raw file
 1/*
 2 * JBoss, Home of Professional Open Source
 3 * Copyright 2011, Red Hat, Inc. and individual contributors
 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
23/**
24 * Start time:11:34:01 2009-04-24<br>
25 * Project: mobicents-isup-stack<br>
26 * 
27 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
28 *         </a>
29 * 
30 */
31package org.mobicents.protocols.ss7.isup.impl.message.parameter;
32
33import org.mobicents.protocols.ss7.isup.ParameterException;
34import org.testng.annotations.Test;
35
36/**
37 * Start time:11:34:01 2009-04-24<br>
38 * Project: mobicents-isup-stack<br>
39 * 
40 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
41 *         </a>
42 */
43public class EventInformationTest extends ParameterHarness {
44
45	public EventInformationTest() {
46		super();
47		super.goodBodies.add(new byte[] { 67 });
48		super.badBodies.add(new byte[2]);
49	}
50
51	private byte[] getBody(int _EI, boolean _RI) {
52		byte[] b = new byte[1];
53		int v = _EI;
54		if (_RI)
55			v |= 0x01 << 7;
56
57		b[0] = (byte) v;
58
59		return b;
60	}
61	@Test(groups = { "functional.encode","functional.decode","parameter"})
62	public void testBody1EncodedValues() throws ParameterException {
63		EventInformationImpl eci = new EventInformationImpl(getBody(EventInformationImpl._EVENT_INDICATOR_CFONNR, EventInformationImpl._EVENT_PRESENTATION_IPR));
64
65		String[] methodNames = { "getEventIndicator", "isEventPresentationRestrictedIndicator" };
66		Object[] expectedValues = { EventInformationImpl._EVENT_INDICATOR_CFONNR, EventInformationImpl._EVENT_PRESENTATION_IPR };
67		super.testValues(eci, methodNames, expectedValues);
68	}
69
70	/*
71	 * (non-Javadoc)
72	 * 
73	 * @see
74	 * org.mobicents.isup.messages.parameters.ParameterHarness#getTestedComponent
75	 * ()
76	 */
77	
78	public AbstractISUPParameter getTestedComponent() throws ParameterException {
79		return new EventInformationImpl(new byte[1]);
80	}
81
82}