Opened 11 years ago
Closed 9 years ago
#665 closed defect (fixed)
Fix existing Petascope JUnit tests
Reported by: | Piero Campalani | Owned by: | Bang Pham Huu |
---|---|---|---|
Priority: | minor | Milestone: | 9.2 |
Component: | petascope | Version: | development |
Keywords: | junit tests | Cc: | Dimitar Misev |
Complexity: | Medium |
Description
Among the few JUnit tests currently available for Petascope, some of them is not working (anymore): the code needs to be updated.
Change History (7)
comment:1 by , 11 years ago
Status: | new → accepted |
---|
comment:2 by , 11 years ago
comment:4 by , 10 years ago
Owner: | changed from | to
---|---|
Priority: | major → minor |
Status: | accepted → assigned |
comment:5 by , 9 years ago
Milestone: | 9.0.x → 9.1.x |
---|---|
Owner: | changed from | to
comment:6 by , 9 years ago
Cc: | added |
---|---|
Milestone: | 9.1.x → 9.2 |
The problem with confDir in concurrentRasdamanRequests() is annoying but the only way to solve is when "make install" then make a copy of web.xml to "WEB-INT/classes/web.xml" and can parse the "confDir" param from non-servlet class (without context) by
// InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("web.xml"); // String confDir = StringUtilTest.getStringFromInputStream(inputStream);
However, as this is use only for tester then I've throws an exception that if tester not change the default configuration (@confDir@) it will not run the test.
The other problem is "threads are racing" with the old code (using a boolean variable and check thread.isDone() as a sign) to start to check the result from all threads.
However, this is not "safe" and the result is "Could not get free server" when run file TestSystemOverloaded.java.
Solution is using thread join in a array of thread
Thread threadList[] = new Thread[queries.length]; for (int i = 0; i < queries.length; i++) { queries[i] = new RasdamanQuery(); threadList[i] = new Thread(); threadList[i].start(); } // Wait all threads are finished for (int i = 0; i < queries.length; i++) { threadList[i].join(); }
A small problem is "Test Packages" can not run first time, due to a configuration in NetBeans Project, the default support from NetBeans is "GlassFish Server". So a manually fix way is right click "Test Packages" → "Properties" → Run (Server: GlassFish Server). This will be added to patch also.
I will submit a patch soon (tomorrow)
comment:7 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
close as patch has been accepted.
Concurrence test code fixed in changeset:62c05ff.
Variable
@confdir@
is however not replaced by the configured path in Petascope so it needs a manual intervent by the tester.When the folder is properly configured to point to
petascope.properties
, the tests here anyway fail with already 2 parallel requests ('cannot get free rasdaman server'
).