db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6315) Improve test coverage of org.apache.derby.impl.io.InputStreamFile
Date Thu, 29 Aug 2013 01:59:51 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13753181#comment-13753181
] 

Bryan Pendleton commented on DERBY-6315:
----------------------------------------

Hi Ahsan,

I think you can start with o.a.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest

This class exercises all three of the methods you mention.

Here is a stack track showing how the test exercises the InputStreamFile constructor:

java.lang.Exception: InputStreamFile(factory,path)
	at org.apache.derby.impl.io.InputStreamFile.<init>(InputStreamFile.java:52)
	at org.apache.derby.impl.io.JarDBFile.<init>(JarDBFile.java:51)
	at org.apache.derby.impl.io.JarStorageFactory.newPersistentFile(JarStorageFactory.java:48)
	at org.apache.derby.impl.io.BaseStorageFactory.newStorageFile(BaseStorageFactory.java:133)
	at org.apache.derby.impl.io.JarStorageFactory.newStorageFile(JarStorageFactory.java:35)
	at org.apache.derby.impl.services.monitor.StorageFactoryService$1.run(StorageFactoryService.java:107)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.<init>(StorageFactoryService.java:96)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getPersistentService(BaseMonitor.java:1639)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getPersistentService(BaseMonitor.java:1621)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getServiceProvider(BaseMonitor.java:1609)
	at org.apache.derby.impl.services.monitor.FileMonitor.getServiceProvider(FileMonitor.java:44)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderFromName(BaseMonitor.java:1596)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1495)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2802)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:404)
	at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:618)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:555)
	at org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest.readOnlyTest(DatabaseClassLoadingTest.java:767)
	at org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest.testDatabaseInJar(DatabaseClassLoadingTest.java:638)

And here is a stack trace showing how the test executes the mkdirs() method:

java.lang.Exception: InputStreamFile.mkdirs
	at org.apache.derby.impl.io.InputStreamFile.mkdirs(InputStreamFile.java:272)
	at org.apache.derby.impl.services.monitor.StorageFactoryService$1.run(StorageFactoryService.java:108)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.<init>(StorageFactoryService.java:96)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getPersistentService(BaseMonitor.java:1639)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getPersistentService(BaseMonitor.java:1621)
	at org.apache.derby.impl.services.monitor.BaseMonitor.getServiceProvider(BaseMonitor.java:1609)
	at org.apache.derby.impl.services.monitor.FileMonitor.getServiceProvider(FileMonitor.java:44)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderFromName(BaseMonitor.java:1596)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1495)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2802)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:404)
	at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:618)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:555)
	at org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest.readOnlyTest(DatabaseClassLoadingTest.java:767)
	at org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest.testDatabaseInJar(DatabaseClassLoadingTest.java:638)

Lastly, here is a stack trace showing how the test executes the toString method:

java.lang.Exception: InputStreamFile.toString
	at org.apache.derby.impl.io.InputStreamFile.toString(InputStreamFile.java:427)
	at org.apache.derby.impl.io.CPFile.getInputStream(CPFile.java:114)
	at org.apache.derby.impl.services.monitor.StorageFactoryService$4.run(StorageFactoryService.java:290)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.derby.impl.services.monitor.StorageFactoryService.getServiceProperties(StorageFactoryService.java:267)
	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1508)
	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:988)
	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:546)
	at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2802)
	at org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:404)
	at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(InternalDriver.java:628)
	at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:282)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:618)
	at org.apache.derby.jdbc.EmbeddedBaseDataSource.getConnection(EmbeddedBaseDataSource.java:555)
	at org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest.testDatabaseInClasspath(DatabaseClassLoadingTest.java:647)

So you can't simply add direct calls to the methods in your new test cases,
but examining the code along these stack traces should give you some clues
about how to provoke some of the other InputStreamFile methods to be
exercised by the test.

thanks,

bryan

                
> Improve test coverage of org.apache.derby.impl.io.InputStreamFile
> -----------------------------------------------------------------
>
>                 Key: DERBY-6315
>                 URL: https://issues.apache.org/jira/browse/DERBY-6315
>             Project: Derby
>          Issue Type: Sub-task
>          Components: JDBC
>            Reporter: ahsan shamsudeen
>            Assignee: ahsan shamsudeen
>            Priority: Minor
>              Labels: gsoc2013
>
> According to code coverage analysis, org.apache.derby.impl.io.InputStreamFile has a poor
code coverage.
> This task is to investigate this class and add regression test that exercise the code,
as appropriate. The current coverage report of the class can be found at  http://dbtg.foundry.sun.com/derby/test/coverage/_files/9a.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message