tct3_javasrc_patch.patch 18.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
Index: adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java
===================================================================
--- adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java	(revision 1471)
+++ adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java	(working copy)
@@ -37,7 +37,6 @@
 		ports.put("btpPort", BtpPort.class);
 		ports.put("geoNetworkingPort", GnPort.class);
 		ports.put("ipv6OverGeoNetworkingPort", Gn6Port.class);
-		ports.put("v2gPort", V2GPort.class);
 	}
 
 	/**
13 14
Index: adapter/org/etsi/its/adapter/ports/V2GPort.java
===================================================================
15
--- adapter/org/etsi/its/adapter/ports/V2GPort.java	(revision 1471)
16 17 18 19 20 21 22 23 24 25 26 27
+++ 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
===================================================================
28
--- adapter/org/etsi/its/adapter/TestAdapter.java	(revision 1471)
29 30 31 32 33 34 35 36 37
+++ 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;
38 39
@@ -70,10 +69,14 @@
 		return required.getTriStatus(TriStatus.TRI_OK);
40 41
 	} 
 
42 43 44 45 46
+	@Override
+	public TriStatus triExecuteTestCase(TriTestCaseId tcId, TriPortIdList portList) {
+		return triExecuteTestcase(tcId, portList);
+	}
+
47
 	/* (non-Javadoc)
48 49
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
 	 */
50 51
-	@Override
     public TriStatus triExecuteTestcase(final TriTestCaseId tcId, final TriPortIdList portList) {
52 53 54 55
 		return required.getTriStatus(TriStatus.TRI_OK);
 	} 
@@ -296,14 +299,14 @@
 		return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionInformal not implemented");	
56 57
 	}
 
58
-	/**
59 60 61 62 63 64 65
-	 * 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");
-	}
66 67 68 69 70 71 72 73 74 75
+//	/**
+//	 * 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");
+//	}
 
 	/**
76
      * triMapParam not implemented
77
@@ -322,4 +325,21 @@
78 79 80 81 82
     public TriStatus triUnmapParam(TriPortId compPortId, TriPortId tsiPortId, TriParameterList paramList) {
 		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
 	}
+
+	@Override
83 84 85 86 87 88 89 90 91
+	public TriStatus triGetStreamValue(TriComponentId arg0, TriPortId arg1,
+			TriAddress arg2, TriMessage arg3) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
+	}
+
+	@Override
+	public TriStatus triSetStreamValue(TriComponentId arg0, TriPortId arg1,
+			TriAddress arg2, TriMessage arg3) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
92 93 94 95
+	}
+
+	@Override
+	public TriStatus triStaticMap(TriPortId arg0, TriPortId arg1) {
96
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
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
Index: codec/org/etsi/codec/ITciCDWrapper.java
===================================================================
--- codec/org/etsi/codec/ITciCDWrapper.java	(revision 1471)
+++ codec/org/etsi/codec/ITciCDWrapper.java	(working copy)
@@ -27,9 +27,33 @@
 	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
 	 * @return An instance of Type representing a TTCN-3 integer type
 	 */
-	public IntegerValue getInteger();
+	public IntegerValue setInteger(final Integer value);
 
 	/** 
+	 * Constructs and returns a basic TTCN-3 big integer type
+	 * 
+	 * @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
+	 * @return An instance of Type representing a TTCN-3 integer type
+	 */
+	public IntegerValue setInteger(final BigInteger value);
+	
+	/** 
+	 * Constructs and returns a basic integer type
+	 * 
+	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
+	 * @return An instance of Type representing a TTCN-3 integer type
+	 */
+	public int getInteger(final IntegerValue iv);
+
+	/** 
+	 * Constructs and returns a basic big integer type
+	 * 
+	 * @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
+	 * @return An instance of Type representing a TTCN-3 integer type
+	 */
+	public long/*TODO BigInteger*/ getBigInteger(final IntegerValue iv);
+
+	/** 
 	 * Constructs and returns a basic TTCN-3 octet string type
 	 * 
 	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getOctetstring
@@ -44,14 +68,6 @@
 	 * @return An instance of Type representing a TTCN-3 float type
 	 */
 	public FloatValue getFloat();
-
-	/** 
-	 * Constructs and returns a basic TTCN-3 big integer type
-	 * 
-	 * @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
-	 * @return An instance of Type representing a TTCN-3 integer type
-	 */
-	IntegerValue getBigInteger(BigInteger bigInt);
 	
 	/** 
 	 * Constructs and returns a basic TTCN-3 float type
Index: codec/org/etsi/ttcn/codec/CodecFactory.java
===================================================================
--- codec/org/etsi/ttcn/codec/CodecFactory.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/CodecFactory.java	(working copy)
@@ -61,7 +61,7 @@
             org.etsi.ttcn.codec.its.uppertester.Plugin.init();
             org.etsi.ttcn.codec.its.geonetworking.Plugin.init();
             org.etsi.ttcn.codec.its.btp.Plugin.init();
-                                 
+            org.etsi.ttcn.codec.its.security.Plugin.init();
         }        
     }
 
166 167
Index: codec/org/etsi/ttcn/codec/generic/Integer.java
===================================================================
168
--- codec/org/etsi/ttcn/codec/generic/Integer.java	(revision 1471)
169
+++ codec/org/etsi/ttcn/codec/generic/Integer.java	(working copy)
170 171 172
@@ -46,17 +46,17 @@
         try {
             Matcher matcher = UNSIGNED_VARIANT.matcher(decodingHypothesis.getTypeEncodingVariant());
173
             if(matcher.find()) {
174 175
-                // Unsigned integer                
-                if(lengthInBits >= 32) {                 
176
-                    iv.setBigInt(new BigInteger(1, value)); // /!\ ttwb specific
177 178 179
+                // Unsigned integer
+                if(lengthInBits >= java.lang.Integer.SIZE) { 
+                    iv = mainCodec.getTciCDRequired().setInteger(new BigInteger(1, value)); 
180 181 182
                 }
                 else {
-                    iv.setInt(ByteHelper.byteArrayToInt(value));
183
+                    iv = mainCodec.getTciCDRequired().setInteger(ByteHelper.byteArrayToInt(value));
184 185 186 187 188 189 190 191 192
                 }
             }
             else {
                 // Signed integer 
-                iv.setInt(ByteHelper.byteArrayToSignedInt(value, lengthInBits));
+                iv.setInteger(ByteHelper.byteArrayToSignedInt(value, lengthInBits));
             }
         }
         catch(Exception e) {
193
@@ -87,10 +87,10 @@
194
         
195 196 197 198 199 200 201 202 203
 //        System.out.println(String.format("Integer.encode: length: %d", lengthInBytes));
         if (lengthInBits > java.lang.Integer.SIZE) {
-            encoded = ByteHelper.longToByteArray(iv.getBigInt().longValue(), lengthInBytes);
+            encoded = ByteHelper.longToByteArray(mainCodec.getTciCDRequired().getBigInteger(iv), lengthInBytes);
             res.setBits(encoded, lengthInBits);
         } else {
-            encoded = ByteHelper.intToByteArray(iv.getInt(), lengthInBytes);
+            encoded = ByteHelper.intToByteArray(mainCodec.getTciCDRequired().getInteger(iv), lengthInBytes);
             res.setBits(encoded, lengthInBits);
204
         }
205
         res.setBits(encoded, lengthInBits);
206 207
Index: codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java
===================================================================
208
--- codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(revision 1471)
209 210 211 212 213 214 215 216 217 218 219 220
+++ 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
===================================================================
221
--- codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(revision 1471)
222 223 224 225 226 227 228 229 230 231
+++ 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));
         }
     }
232 233 234 235 236 237 238 239 240 241 242 243 244 245
Index: codec/org/etsi/ttcn/codec/its/security/Plugin.java
===================================================================
--- codec/org/etsi/ttcn/codec/its/security/Plugin.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/its/security/Plugin.java	(working copy)
@@ -13,7 +13,6 @@
     public static void init() {
 
         CodecFactory cf = CodecFactory.getInstance();
-//        cf.setCodec(TciTypeClass.UNION, "LibItsSecurity", "LibItsSecurity", BtpHeader.class);
-//        cf.setCodec(TciTypeClass.RECORD, "LibItsSecurity", "LibItsSecurity", Payload.class);
+        cf.setCodec(TciTypeClass.RECORD, "LibItsSecurity", "Payload", Payload.class);
     }
 }
\ No newline at end of file
246 247
Index: codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java
===================================================================
248
--- codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(revision 1471)
249 250 251 252 253 254 255 256 257 258
+++ 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");
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
Index: codec/org/etsi/ttcn/codec/MainCodec.java
===================================================================
--- codec/org/etsi/ttcn/codec/MainCodec.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/MainCodec.java	(working copy)
@@ -8,6 +8,7 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.etsi.codec.ITciCDWrapper;
 import org.etsi.ttcn.tri.TriMessage;
 import org.etsi.ttcn.tci.TciCDProvided;
 import org.etsi.ttcn.tci.TciCDRequired;
@@ -16,9 +17,9 @@
 
 public class MainCodec extends ICodec {
 
-    public MainCodec(TciCDRequired cdReq) {
+    public MainCodec(ITciCDWrapper _cdReq) {
         super(null);
-        this.cdReq = cdReq;
+        this.cdReq = _cdReq;
     }
 
     public Value triDecode(TriMessage message, Type decodingHypothesis) {
@@ -97,11 +98,11 @@
         presenceHints.put(key, value);
     }
 
-    public TciCDRequired getTciCDRequired() {
+    public ITciCDWrapper getTciCDRequired() {
         return cdReq;
     }
 
     protected Map<String, String> hints = new TreeMap<String, String>();
     protected Map<String, java.lang.Boolean> presenceHints = new TreeMap<String, java.lang.Boolean>();
-    protected TciCDRequired cdReq;
+    protected ITciCDWrapper cdReq;
 }
297 298
Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
===================================================================
299
--- extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(revision 1471)
300
+++ extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(working copy)
301 302 303
@@ -79,24 +79,19 @@
         
         String datestr="01/01/2004 00:00:00";
304
         DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
305 306
-        IntegerValue now = _tcicdWrapper.getInteger();
+        IntegerValue now = null;
307
         try {
308 309 310 311 312 313 314 315 316 317 318 319
-//            System.out.println(String.format("fx_getCurrentTime: now:%d, 2004:%d", System.currentTimeMillis(), ((java.util.Date)formatter.parse(datestr)).getTime()));
-//            System.out.println("Diff: " + (int)(System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime()));
-            now.setBigInt(
+            now = _tcicdWrapper.setInteger(
                 new BigInteger(
                     1, 
-                    ByteHelper.longToByteArray(
-                        System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime(),
-                        Long.SIZE / Byte.SIZE
-                    )
+                    ByteHelper.longToByteArray(System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime(), Long.SIZE / Byte.SIZE)
                 )
320 321 322
             );
         } catch (ParseException e) {
-            now.setInt(0);
323
+        	now = _tcicdWrapper.setInteger(0);
324 325 326 327 328 329 330
         }
         
-        _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
 
331
@@ -122,17 +117,17 @@
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
             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)));
356
@@ -172,17 +167,17 @@
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
         _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)
380
@@ -200,8 +195,8 @@
381 382 383 384 385 386 387 388 389 390
         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
 
391 392 393
@@ -226,11 +221,14 @@
      */
     @Override
394
     public IntegerValue fx_computeGnTimestamp() {
395 396 397
-
-        IntegerValue timestamp = _tcicdWrapper.getInteger();
         
398 399
-        // /!\ ttwb specific
-        timestamp.setBigInt(new BigInteger(1, ByteHelper.longToByteArray(((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32)), 5)));
400 401 402 403 404 405 406
+        IntegerValue timestamp = _tcicdWrapper.setInteger(
+                new BigInteger(
+                    1,
+                    ByteHelper.longToByteArray((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32), Long.SIZE / Byte.SIZE) 
+                )
+            );
+        
407 408 409
         return timestamp;
     }
 
410
@@ -305,11 +303,11 @@
411 412 413 414 415 416 417 418 419 420 421 422 423
         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();
         }