Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361468

Summary: Timestamp & date throws service invocation exception
Product: z_Archived Reporter: Jing Qian <jqian>
Component: EDTAssignee: Huang Ji Yong <hjiyong>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: mayunf, pharmon, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jing Qian CLA 2011-10-19 15:56:32 EDT
Check out the following project from kan-cvs-save
/cvsroot/rbd
check out project egl.rest from module org.eclipse.edt.tests.services

right click on the project (or egl packages, or egl files), Generate EGL Test driver => javaScript Async

you will see the driver project egl.rest.javascript.async 

run rui handler under eunitgen.libraries.async
TestPrimitives_rui.egl

after it finishes running, refresh project egl.rest.javascript.async, you should see a folder called ResultRoot, open the result summary file, you can see there are 40 tests, 27 passed, 11 has errors, 2 has failures.

Please look at the timestamp and date tests

==> timestamp_in test, I get the following service exception

TestPrimitives_DEDICATED_BINDING::testTimestamp_inParm: ERROR - Caught service exception: EGL0023E: An error occurred while trying to invoke function:{"method":"timestamp_inParm","params":["Cannot toJSONString Tue Feb 15 2005 12:30:11 GMT-0500 (Eastern Standard Time)]} on EGL Service:services.PrimitivePassing.
detail1:
detail2:
detail3:org.eclipse.edt.javart.json.TokenMgrError:Lexical error at line 1, column 120.  Encountered: <EOF> after : "\"Cannot toJSONString Tue Feb 15 2005 12:30:11 GMT-0500 (Eastern Standard Time)]}"

==> date_in test, I get the following service exception

TestPrimitives_DEDICATED_BINDING::testDate_inParm: ERROR - Caught service exception: EGL0023E: An error occurred while trying to invoke function:{"method":"date_inParam","params":["Cannot toJSONString Tue Mar 02 2010 00:00:00 GMT-0500 (Eastern Standard Time)]} on EGL Service:services.PrimitivePassing.
detail1:
detail2:
detail3:org.eclipse.edt.javart.json.TokenMgrError:Lexical error at line 1, column 116.  Encountered: <EOF> after : "\"Cannot toJSONString Tue Mar 02 2010 00:00:00 GMT-0500 (Eastern Standard Time)]}"
Comment 1 Joseph Vincens CLA 2011-10-20 11:10:49 EDT
fixed
Primitives: reason: test case: 40; all passed
Comment 2 Jing Qian CLA 2011-11-11 15:21:43 EST
I tried to verify this using 2011/11/11/0901's build, find the timestamp inout and timestamp out are failing (it was successful 2 days ago)

so I think they're caused by javascripg gen regression.

Please take a look
Comment 3 Jing Qian CLA 2011-11-11 15:36:58 EST
this is the error of in javascript

[CRRUI1070E] An [CRRUI2002E] testTimestamp_inoutParm
An error occurred inside TestPrimitives: date.getMilliseconds is not a function exception occurred while processing the call back function. Use the try...OnException.
[CRRUI2002E] testTimestamp_inoutParm
An error occurred inside TestPrimitives: date.getMilliseconds is not a function
[CRRUI2094E] Here are the EGL function calls leading to this error:

    libraries/async/TestPrimitives.egl() at line 29
    libraries/async/TestPrimitives.egl() at line 200
    org/eclipse/edt/eunit/runtime/TestListMgr.egl() at line 42
    libraries/async/TestPrimitives.egl() at line 628
    RUI Runtime.Handling callback for services.PrimitivePassing() [native JavaScript]
    RUI Runtime.Response for services.PrimitivePassing() [native JavaScript]

Running test: TestPrimitives_DEDICATED_BINDING::testTimestamp_inoutParm
[CRRUI1072E] An [CRRUI2002E] testTimestamp_outParm
An error occurred inside TestPrimitives: date.getMilliseconds is not a function exception occurred in the error call back function, code with try...OnException
[CRRUI2002E] testTimestamp_outParm
An error occurred inside TestPrimitives: date.getMilliseconds is not a function
[CRRUI2094E] Here are the EGL function calls leading to this error:

    libraries/async/TestPrimitives.egl() at line 29
    libraries/async/TestPrimitives.egl() at line 207
    org/eclipse/edt/eunit/runtime/TestListMgr.egl() at line 42
    org/eclipse/edt/eunit/runtime/TestListMgr.egl() at line 86
    libraries/async/TestPrimitives.egl() at line 33

Running test: TestPrimitives_DEDICATED_BINDING::testTimestamp_outParm
[CRRUI1072E] An [CRRUI2002E] testTimestamp_allParm
Comment 4 Jing Qian CLA 2011-11-15 11:39:29 EST
mark as major, since this is a regression
Comment 5 Huang Ji Yong CLA 2011-11-16 02:52:02 EST
Hi Jing,
The new problem is caused by the type inconsistency.
The service function parameter type is timestamp
function timestamp_inoutparm (p timestamp inout)
    p = "2005/02/15-12:35:11";
end
But when calling the service the parameter type is timestamp("yyyyMMddHHmmss")
 timestamp1 timestamp("yyyyMMddHHmmss") = "19990101010101";        
 call getPrimitiveService().timestamp_inoutParm(timestamp1) returning to verifyTimestamp_inoutParm onException handleServiceException;

If you try such case in a handler by direct function call, it may produce compile error. Sample code:
    function start()
    	timestamp1 timestamp("yyyyMMddHHmmss") = "19990101010101";
    	timestamp_inoutparm(timestamp1);
    end
    
    function timestamp_inoutparm (p timestamp inout)
   		p = "2005/02/15-12:35:11";
  	end

So I wondering if the test case is valid.
If it is invalid, we may have to add validation for such case.
Comment 6 Jing Qian CLA 2011-11-16 10:03:54 EST
verified with 201111160901's build.

modified the test case, changed the parameter to value type
Now, all services tests runs 100% successful

Opened Bug# 363919 for the validation need