tct3_javasrc_patch.patch 12.5 KB
Newer Older
filatov's avatar
filatov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
Index: adapter/org/etsi/its/adapter/ports/V2GPort.java
===================================================================
--- adapter/org/etsi/its/adapter/ports/V2GPort.java	(revision 653)
+++ adapter/org/etsi/its/adapter/ports/V2GPort.java	(working copy)
@@ -75,7 +75,7 @@
 		role = ((CharstringValue)TERFactory.getInstance().getTaParameter("V2gTsRole")).getString();
 		v2gHost = ((CharstringValue)TERFactory.getInstance().getTaParameter("V2gSeccAddress")).getString();
 		//v2gPort = Integer.decode(((CharstringValue)TERFactory.getInstance().getTaParameter("V2gSeccPort")).getString());
-		v2gPort = ((IntegerValue)TERFactory.getInstance().getTaParameter("V2gSeccPort")).getInt();
+		v2gPort = ((IntegerValue)TERFactory.getInstance().getTaParameter("V2gSeccPort")).getInteger();
 		try {
 			sdpPeerAddress = InetAddress.getByName("ff02::1");
 		} catch (UnknownHostException e1) {
Index: adapter/org/etsi/its/adapter/TestAdapter.java
===================================================================
--- adapter/org/etsi/its/adapter/TestAdapter.java	(revision 653)
+++ adapter/org/etsi/its/adapter/TestAdapter.java	(working copy)
@@ -19,7 +19,6 @@
 import org.etsi.its.adapter.ports.ProtocolPortFactory;
 import org.etsi.its.adapter.ports.UpperTesterPort;
 import org.etsi.ttcn.tci.CharstringValue;
-import org.etsi.ttcn.tri.TriActionTemplate;
 import org.etsi.ttcn.tri.TriAddress;
 import org.etsi.ttcn.tri.TriAddressList;
 import org.etsi.ttcn.tri.TriCommunicationSA;
@@ -71,14 +70,13 @@
 	} 
 
 	/* (non-Javadoc)
-	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
-	 */
-	@Override
+     * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
+     */
     public TriStatus triExecuteTestcase(final TriTestCaseId tcId, final TriPortIdList portList) {
-		return required.getTriStatus(TriStatus.TRI_OK);
-	} 
+        return required.getTriStatus(TriStatus.TRI_OK);
+    } 
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triMap(org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriPortId)
 	 */
 	@Override
@@ -297,15 +295,6 @@
 	}
 
 	/**
-	 * triSutActionTemplate not implemented
-	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triSutActionTemplate(org.etsi.ttcn.tri.TriActionTemplate)
-	 */
-	@Override
-	public TriStatus triSutActionTemplate(TriActionTemplate templateValue) {
-		return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionTemplate not implemented");
-	}
-
-	/**
      * triMapParam not implemented
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triMapParam(org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriParameterList)
 	 */
@@ -322,4 +311,14 @@
     public TriStatus triUnmapParam(TriPortId compPortId, TriPortId tsiPortId, TriParameterList paramList) {
 		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
 	}
+
+	@Override
+	public TriStatus triExecuteTestCase(TriTestCaseId tcId, TriPortIdList portList) {
+		return this.triExecuteTestcase(tcId, portList);
+	}
+
+	@Override
+	public TriStatus triStaticMap(TriPortId arg0, TriPortId arg1) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triMapParam not implemented");
+	}
 } 
Index: codec/org/etsi/ttcn/codec/generic/Integer.java
===================================================================
--- codec/org/etsi/ttcn/codec/generic/Integer.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/generic/Integer.java	(working copy)
@@ -48,15 +48,15 @@
             if(matcher.find()) {
                 // Unsigned integer                
                 if(lengthInBits >= 32) {                 
-                    iv.setBigInt(new BigInteger(1, value)); // /!\ ttwb specific
+                    iv.setInteger(java.lang.Integer.MAX_VALUE);  //!\ testcastT3 does not support big integer
                 }
                 else {
-                    iv.setInt(ByteHelper.byteArrayToInt(value));
+                    iv.setInteger(ByteHelper.byteArrayToInt(value));
                 }
             }
             else {
                 // Signed integer 
-                iv.setInt(ByteHelper.byteArrayToSignedInt(value, lengthInBits));
+                iv.setInteger(ByteHelper.byteArrayToSignedInt(value, lengthInBits));
             }
         }
         catch(Exception e) {
@@ -85,7 +85,7 @@
         }
         lengthInBytes = lengthInBits / 8 + (((lengthInBits % 8) > 0)?1:0);
         
-        encoded = ByteHelper.intToByteArray(iv.getInt(), lengthInBytes);
+        encoded = ByteHelper.intToByteArray(iv.getInteger(), lengthInBytes);
         res.setBits(encoded, lengthInBits);
 
         return res;
Index: codec/org/etsi/ttcn/codec/ICodec.java
===================================================================
--- codec/org/etsi/ttcn/codec/ICodec.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/ICodec.java	(working copy)
@@ -35,6 +35,8 @@
         }
         catch(Exception e) {
             // Empty on purpose
+            System.err.println(e.getMessage());
+            return -1;
         }
         return 0;
     }
Index: codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java
===================================================================
--- codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(working copy)
@@ -27,7 +27,7 @@
     protected void postDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {
 
         if(fieldName.equals("hdrLen")) {
-            int len = ((IntegerValue)(rv.getField(fieldName))).getInt();
+            int len = ((IntegerValue)(rv.getField(fieldName))).getInteger();
             mainCodec.setHint("Ipv6ExtHdrLen", Integer.toString(len));
         }
     }
Index: codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java
===================================================================
--- codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(working copy)
@@ -39,7 +39,7 @@
         }
 
         else if(fieldName.equals("plLength")) {
-            int pl = ((IntegerValue)(rv.getField(fieldName))).getInt();
+            int pl = ((IntegerValue)(rv.getField(fieldName))).getInteger();
             mainCodec.setHint("payloadLength", Integer.toString(pl));
         }
     }
Index: codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java
===================================================================
--- codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(working copy)
@@ -126,7 +126,7 @@
         }
 
         else if(fieldName.equals("inlineNextHeader")) {
-            int nh = ((IntegerValue)(rv.getField(fieldName))).getInt();
+            int nh = ((IntegerValue)(rv.getField(fieldName))).getInteger();
             mainCodec.setHint("Ipv6NextHeader", Integer.toString(nh));
             if(nh == 0 || nh == 60 || nh == 43 || nh == 44) { 
                 mainCodec.setHint("ExtensionHeaderListMore", "true");
Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
===================================================================
--- extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(revision 653)
+++ extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(working copy)
@@ -7,7 +7,6 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.text.DateFormat;
@@ -81,15 +80,15 @@
         DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
         IntegerValue now = _tcicdWrapper.getInteger();
         try {
-            now.setInt(
+            now.setInteger(
                 (int)
                     (System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime())
             );
         } catch (ParseException e) {
-            now.setInt(0);
+            now.setInteger(0);
         }
         
-        _logger.exiting("ItsExternalFunctionsProvider", "fx_getCurrentTime", String.format("%10d", now.getInt())); 
+        _logger.exiting("ItsExternalFunctionsProvider", "fx_getCurrentTime", String.format("%10d", now.getInteger())); 
         return now;
     } // End of method fx_getCurrentTime
 
@@ -115,17 +114,17 @@
             final IntegerValue p_latitudeA, final IntegerValue p_longitudeA,
             final IntegerValue p_latitudeB, final IntegerValue p_longitudeB) {
         _logger.entering("ItsExternalFunctionsProvider", "fx_computeDistance",
-                String.format("%d, %d, %d, %d", p_latitudeA.getInt(),
-                        p_longitudeA.getInt(), p_latitudeB.getInt(),
-                        p_longitudeB.getInt()));
+                String.format("%d, %d, %d, %d", p_latitudeA.getInteger(),
+                        p_longitudeA.getInteger(), p_latitudeB.getInteger(),
+                        p_longitudeB.getInteger()));
 
         // Initialise the returned value
         FloatValue dist = _tcicdWrapper.getFloat();
 
-        double dlat = (new Double(p_latitudeB.getInt()) - new Double(
-                p_latitudeA.getInt())) / 10000000;
-        double dlong = (new Double(p_longitudeB.getInt()) - new Double(
-                p_longitudeA.getInt())) / 10000000;
+        double dlat = (new Double(p_latitudeB.getInteger()) - new Double(
+                p_latitudeA.getInteger())) / 10000000;
+        double dlong = (new Double(p_longitudeB.getInteger()) - new Double(
+                p_longitudeA.getInteger())) / 10000000;
 
         long d = Math.round(Math.sqrt(Math.pow(dlat * rbis, 2)
                 + Math.pow(dlong * rbis * Math.cos(dlat), 2)));
@@ -165,17 +164,17 @@
         _logger.entering(
                 "ItsExternalFunctionsProvider",
                 "fx_computePositionUsingDistance",
-                String.format("%d, %d", p_distance.getInt(),
-                        p_orientation.getInt()));
+                String.format("%d, %d", p_distance.getInteger(),
+                        p_orientation.getInteger()));
 
-        double angularD = new Double(p_distance.getInt()) / earthRadius;
-        double radHeading = new Double(p_orientation.getInt()) * Math.PI
+        double angularD = new Double(p_distance.getInteger()) / earthRadius;
+        double radHeading = new Double(p_orientation.getInteger()) * Math.PI
                 / 180;
 
         // Convert to rad
-        double lat1 = (new Double(p_refLatitude.getInt()) / 10000000)
+        double lat1 = (new Double(p_refLatitude.getInteger()) / 10000000)
                 * Math.PI / 180;
-        double long1 = (new Double(p_refLongitude.getInt()) / 10000000)
+        double long1 = (new Double(p_refLongitude.getInteger()) / 10000000)
                 * Math.PI / 180;
 
         double lat2 = Math.asin(Math.sin(lat1) * Math.cos(angularD)
@@ -193,8 +192,8 @@
         long rlat2 = Math.round(lat2 * 10000000 / Math.PI * 180);
         long rlong2 = Math.round(long2 * 10000000 / Math.PI * 180);
 
-        p_latitude.setInt((int) rlat2);
-        p_longitude.setInt((int) rlong2);
+        p_latitude.setInteger((int) rlat2);
+        p_longitude.setInteger((int) rlong2);
 
     } // End of method fx_computePositionUsingDistance
 
@@ -221,9 +220,8 @@
     public IntegerValue fx_computeGnTimestamp() {
 
         IntegerValue timestamp = _tcicdWrapper.getInteger();
-        
-        // /!\ ttwb specific
-        timestamp.setBigInt(new BigInteger(1, ByteHelper.longToByteArray(((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32)), 5)));
+        timestamp.setInteger((int)((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32)));
+
         return timestamp;
     }
 
@@ -298,11 +296,11 @@
         try {
             // Upper-Layer Packet Length (32bits)
             pseudoheader.write(ByteHelper.intToByteArray(
-                    p_payloadLength.getInt(), 4));
+                    p_payloadLength.getInteger(), 4));
             // Checksum set to 0 (24bits)
             pseudoheader.write(ByteHelper.intToByteArray(0, 3));
             // Next header (8bits)
-            pseudoheader.write((byte) p_nextHdr.getInt());
+            pseudoheader.write((byte) p_nextHdr.getInteger());
         } catch (IOException e) {
             e.printStackTrace();
         }