PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 83 lines | 28 code | 12 blank | 43 comment | 0 complexity | ecc247c50a03ccd4c092ce4b2621026e 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/**
38 * Start time:11:34:01 2009-04-24<br>
39 * Project: mobicents-isup-stack<br>
40 * 
41 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski
42 *         </a>
43 */
44public class MCIDResponseIndicatorsTest extends ParameterHarness {
45	private static final int _TURN_ON = 1;
46	private static final int _TURN_OFF = 0;
47
48	public MCIDResponseIndicatorsTest() {
49		super();
50		super.goodBodies.add(new byte[] { 3 });
51		super.badBodies.add(new byte[2]);
52	}
53
54	private byte[] getBody(boolean mcidRequest, boolean holdingRequested) {
55		int b0 = 0;
56
57		b0 |= (mcidRequest ? _TURN_ON : _TURN_OFF);
58		b0 |= ((holdingRequested ? _TURN_ON : _TURN_OFF)) << 1;
59
60		return new byte[] { (byte) b0 };
61	}
62	@Test(groups = { "functional.encode","functional.decode","parameter"})
63	public void testBody1EncodedValues() throws ParameterException {
64		MCIDResponseIndicatorsImpl eci = new MCIDResponseIndicatorsImpl(getBody(MCIDResponseIndicatorsImpl._INDICATOR_PROVIDED, MCIDResponseIndicatorsImpl._INDICATOR_NOT_PROVIDED));
65
66		String[] methodNames = { "isMcidIncludedIndicator", "isHoldingProvidedIndicator" };
67		Object[] expectedValues = { MCIDResponseIndicatorsImpl._INDICATOR_PROVIDED, MCIDResponseIndicatorsImpl._INDICATOR_NOT_PROVIDED };
68		super.testValues(eci, methodNames, expectedValues);
69	}
70
71	/*
72	 * (non-Javadoc)
73	 * 
74	 * @see
75	 * org.mobicents.isup.messages.parameters.ParameterHarness#getTestedComponent
76	 * ()
77	 */
78	
79	public AbstractISUPParameter getTestedComponent() throws ParameterException {
80		return new MCIDResponseIndicatorsImpl(new byte[1]);
81	}
82
83}