2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.impl.serialization.factories.multipart;
\r
10 import io.netty.buffer.ByteBuf;
\r
11 import io.netty.buffer.UnpooledByteBufAllocator;
\r
13 import java.math.BigInteger;
\r
14 import java.util.ArrayList;
\r
15 import java.util.List;
\r
17 import org.junit.Assert;
\r
18 import org.junit.Before;
\r
19 import org.junit.Test;
\r
20 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
\r
21 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
\r
22 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
\r
23 import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
\r
24 import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory;
\r
25 import org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest;
\r
26 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
27 import org.opendaylight.openflowjava.util.ByteBufUtils;
\r
28 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
\r
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;
\r
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;
\r
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
\r
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
\r
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
\r
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;
\r
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;
\r
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;
\r
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
\r
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
\r
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions;
\r
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
\r
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
\r
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
\r
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
\r
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
\r
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
\r
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
\r
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
\r
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
\r
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
\r
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
\r
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
\r
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
\r
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
\r
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
\r
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
\r
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
\r
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
\r
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
\r
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
\r
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;
\r
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
\r
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
\r
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder;
\r
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
\r
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
\r
68 * @author michal.polkorab
\r
71 public class TableFeaturesTest {
\r
72 private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE =
\r
73 MultipartRequestInputFactoryTest.PADDING_IN_MULTIPART_REQUEST_MESSAGE;
\r
74 private SerializerRegistry registry;
\r
75 private OFSerializer<MultipartRequestInput> multipartFactory;
\r
78 * Initializes serializer registry and stores correct factory in field
\r
81 public void startUp() {
\r
82 registry = new SerializerRegistryImpl();
\r
84 multipartFactory = registry.getSerializer(
\r
85 new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequestInput.class));
\r
90 * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO
\r
93 public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {
\r
94 MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
\r
95 BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
\r
96 builder.setType(MultipartType.forValue(12));
\r
97 builder.setFlags(new MultipartRequestFlags(true));
\r
98 MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
\r
99 MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
\r
100 List<TableFeatures> tableFeaturesList = new ArrayList<>();
\r
101 TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
\r
102 tableFeaturesBuilder.setTableId((short) 8);
\r
103 tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
\r
104 tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
\r
105 tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
\r
106 tableFeaturesBuilder.setConfig(new TableConfig(true));
\r
107 tableFeaturesBuilder.setMaxEntries(65L);
\r
108 List<TableFeatureProperties> properties = new ArrayList<>();
\r
109 TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
\r
110 propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
\r
111 NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder =
\r
112 new NextTableRelatedTableFeaturePropertyBuilder();
\r
113 List<NextTableIds> nextIds = new ArrayList<>();
\r
114 nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
\r
115 nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
\r
116 nextPropBuilder.setNextTableIds(nextIds);
\r
117 propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
\r
118 properties.add(propBuilder.build());
\r
119 propBuilder = new TableFeaturePropertiesBuilder();
\r
120 propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
\r
121 nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
\r
122 nextIds = new ArrayList<>();
\r
123 nextIds.add(new NextTableIdsBuilder().setTableId((short) 3).build());
\r
124 nextPropBuilder.setNextTableIds(nextIds);
\r
125 propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
\r
126 properties.add(propBuilder.build());
\r
127 propBuilder = new TableFeaturePropertiesBuilder();
\r
128 propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
\r
129 InstructionRelatedTableFeaturePropertyBuilder insPropBuilder =
\r
130 new InstructionRelatedTableFeaturePropertyBuilder();
\r
131 List<Instruction> insIds = new ArrayList<>();
\r
132 InstructionBuilder insBuilder = new InstructionBuilder();
\r
133 insBuilder.setType(WriteActions.class);
\r
134 insIds.add(insBuilder.build());
\r
135 insBuilder = new InstructionBuilder();
\r
136 insBuilder.setType(GotoTable.class);
\r
137 insIds.add(insBuilder.build());
\r
138 insPropBuilder.setInstruction(insIds);
\r
139 propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
\r
140 properties.add(propBuilder.build());
\r
141 propBuilder = new TableFeaturePropertiesBuilder();
\r
142 propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);
\r
143 insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
\r
144 insIds = new ArrayList<>();
\r
145 insBuilder = new InstructionBuilder();
\r
146 insBuilder.setType(WriteMetadata.class);
\r
147 insIds.add(insBuilder.build());
\r
148 insBuilder = new InstructionBuilder();
\r
149 insBuilder.setType(ApplyActions.class);
\r
150 insIds.add(insBuilder.build());
\r
151 insBuilder = new InstructionBuilder();
\r
152 insBuilder.setType(Meter.class);
\r
153 insIds.add(insBuilder.build());
\r
154 insBuilder = new InstructionBuilder();
\r
155 insBuilder.setType(ClearActions.class);
\r
156 insIds.add(insBuilder.build());
\r
157 insBuilder = new InstructionBuilder();
\r
158 insBuilder.setType(GotoTable.class);
\r
159 insIds.add(insBuilder.build());
\r
160 insPropBuilder.setInstruction(insIds);
\r
161 propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
\r
162 properties.add(propBuilder.build());
\r
163 tableFeaturesBuilder.setTableFeatureProperties(properties);
\r
164 tableFeaturesList.add(tableFeaturesBuilder.build());
\r
165 tableFeaturesBuilder = new TableFeaturesBuilder();
\r
166 tableFeaturesBuilder.setTableId((short) 8);
\r
167 tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
\r
168 tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}));
\r
169 tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}));
\r
170 tableFeaturesBuilder.setConfig(new TableConfig(true));
\r
171 tableFeaturesBuilder.setMaxEntries(67L);
\r
172 properties = new ArrayList<>();
\r
173 propBuilder = new TableFeaturePropertiesBuilder();
\r
174 propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
\r
175 OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
\r
176 List<MatchEntries> entries = new ArrayList<>();
\r
177 MatchEntriesBuilder entriesBuilder = new MatchEntriesBuilder();
\r
178 entriesBuilder.setOxmClass(OpenflowBasicClass.class);
\r
179 entriesBuilder.setOxmMatchField(InPhyPort.class);
\r
180 entriesBuilder.setHasMask(false);
\r
181 entries.add(entriesBuilder.build());
\r
182 entriesBuilder = new MatchEntriesBuilder();
\r
183 entriesBuilder.setOxmClass(OpenflowBasicClass.class);
\r
184 entriesBuilder.setOxmMatchField(InPort.class);
\r
185 entriesBuilder.setHasMask(false);
\r
186 entries.add(entriesBuilder.build());
\r
187 oxmBuilder.setMatchEntries(entries);
\r
188 propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
\r
189 properties.add(propBuilder.build());
\r
190 propBuilder = new TableFeaturePropertiesBuilder();
\r
191 propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);
\r
192 oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
\r
193 entries = new ArrayList<>();
\r
194 entriesBuilder = new MatchEntriesBuilder();
\r
195 entriesBuilder.setOxmClass(OpenflowBasicClass.class);
\r
196 entriesBuilder.setOxmMatchField(IpProto.class);
\r
197 entriesBuilder.setHasMask(false);
\r
198 entries.add(entriesBuilder.build());
\r
199 entriesBuilder = new MatchEntriesBuilder();
\r
200 entriesBuilder.setOxmClass(OpenflowBasicClass.class);
\r
201 entriesBuilder.setOxmMatchField(IpEcn.class);
\r
202 entriesBuilder.setHasMask(false);
\r
203 entries.add(entriesBuilder.build());
\r
204 oxmBuilder.setMatchEntries(entries);
\r
205 propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
\r
206 properties.add(propBuilder.build());
\r
207 propBuilder = new TableFeaturePropertiesBuilder();
\r
208 propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);
\r
209 ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =
\r
210 new ExperimenterRelatedTableFeaturePropertyBuilder();
\r
211 expBuilder.setExperimenter(1024L);
\r
212 expBuilder.setExpType(2048L);
\r
213 byte[] expData = new byte[]{0, 1, 2};
\r
214 expBuilder.setData(expData);
\r
215 propBuilder.addAugmentation(
\r
216 ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());
\r
217 properties.add(propBuilder.build());
\r
218 propBuilder = new TableFeaturePropertiesBuilder();
\r
219 propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);
\r
220 expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();
\r
221 expBuilder.setExperimenter(4098L);
\r
222 expBuilder.setExpType(8152L);
\r
223 byte[] expData2 = new byte[]{3, 4, 6, 7, 8, 9};
\r
224 expBuilder.setData(expData2);
\r
225 propBuilder.addAugmentation(
\r
226 ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());
\r
227 properties.add(propBuilder.build());
\r
228 tableFeaturesBuilder.setTableFeatureProperties(properties);
\r
229 tableFeaturesList.add(tableFeaturesBuilder.build());
\r
230 featuresBuilder.setTableFeatures(tableFeaturesList);
\r
231 caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
\r
232 builder.setMultipartRequestBody(caseBuilder.build());
\r
233 MultipartRequestInput message = builder.build();
\r
235 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
\r
236 multipartFactory.serialize(message, out);
\r
238 BufferHelper.checkHeaderV13(out, (byte) 18, 272);
\r
239 Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
\r
240 Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
\r
241 out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
\r
242 Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());
\r
243 Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
\r
245 Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
\r
246 ByteBufUtils.decodeNullTerminatedString(out, 32));
\r
247 byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
\r
248 out.readBytes(metadataMatch);
\r
249 Assert.assertArrayEquals("Wrong metadata-match",
\r
250 new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
\r
251 byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
\r
252 out.readBytes(metadataWrite);
\r
253 Assert.assertArrayEquals("Wrong metadata-write",
\r
254 new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
\r
255 Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
\r
256 Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
\r
257 Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());
\r
258 Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());
\r
259 Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());
\r
260 Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());
\r
262 Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());
\r
263 Assert.assertEquals("Wrong property length", 5, out.readUnsignedShort());
\r
264 Assert.assertEquals("Wrong next-registry-id", 3, out.readUnsignedByte());
\r
266 Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());
\r
267 Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
\r
268 Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
\r
269 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
270 Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
\r
271 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
273 Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());
\r
274 Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());
\r
275 Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
\r
276 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
277 Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
\r
278 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
279 Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
\r
280 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
281 Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
\r
282 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
283 Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
\r
284 Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
\r
285 Assert.assertEquals("Wrong length", 136, out.readUnsignedShort());
\r
286 Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
\r
288 Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
\r
289 ByteBufUtils.decodeNullTerminatedString(out, 32));
\r
290 metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
\r
291 out.readBytes(metadataMatch);
\r
292 Assert.assertArrayEquals("Wrong metadata-match",
\r
293 new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
\r
294 metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
\r
295 out.readBytes(metadataWrite);
\r
296 Assert.assertArrayEquals("Wrong metadata-write",
\r
297 new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
\r
298 Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
\r
299 Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());
\r
300 Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());
\r
301 Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
\r
302 Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
\r
303 Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());
\r
304 Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
\r
305 Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
\r
306 Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());
\r
307 Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
\r
309 Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());
\r
310 Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
\r
311 Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
\r
312 Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());
\r
313 Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
\r
314 Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
\r
315 Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());
\r
316 Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
\r
318 Assert.assertEquals("Wrong property type", 0xFFFE, out.readUnsignedShort());
\r
319 Assert.assertEquals("Wrong property length", 16, out.readUnsignedShort());
\r
320 Assert.assertEquals("Wrong experimenter", 1024, out.readUnsignedInt());
\r
321 Assert.assertEquals("Wrong exp-type", 2048, out.readUnsignedInt());
\r
322 byte[] tmp = new byte[3];
\r
323 out.readBytes(tmp);
\r
324 Assert.assertArrayEquals("Wrong experimenter data", expData, tmp);
\r
326 Assert.assertEquals("Wrong property type", 0xFFFF, out.readUnsignedShort());
\r
327 Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());
\r
328 Assert.assertEquals("Wrong experimenter", 4098, out.readUnsignedInt());
\r
329 Assert.assertEquals("Wrong exp-type", 8152, out.readUnsignedInt());
\r
330 byte[] tmp2 = new byte[6];
\r
331 out.readBytes(tmp2);
\r
332 Assert.assertArrayEquals("Wrong experimenter data", expData2, tmp2);
\r
334 Assert.assertTrue("Unread data", out.readableBytes() == 0);
\r