You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Manjula Kutty <ma...@gmail.com> on 2007/12/20 00:44:43 UTC
File Permission for ij tests
Hi,
I was trying to convert the test demo/checkToursDB.java to junit and I came
throug this error. Does any one know how to resolve this issue? I saw this
line in the derby_tests.policy file :
// ij needs permission to read the sql files in this jar
permission java.io.FilePermission "${derbyTesting.testjarpath}", "read";
Unexpected while populating the dataaccess denied
(java.io.FilePermissionToursDB_schema.sql read)
at
org.apache.derbyTesting.functionTests.tests.demo.CheckToursDBTest.tes
tDataPopulation(CheckToursDBTest.java:77)
So the policy file is giving the permission
I was trying to execute this code
*
public* *void* testDataPopulation() *throws* SQLException {
String[] dbfiles = {"ToursDB_schema.sql","loadTables.sql"};
Connection conn = getConnection();
*for* (*int* i = 0 ; i < dbfiles.length ; i++)
*try*{
{
String[] ijArgs = {dbfiles[i]};
ij.*main*(ijArgs);
}
} *catch* (Exception e) {
*fail*("Unexpected while populating the data" + e.getMessage());
}
--
Thanks,
Manjula.
Re: File Permission for ij tests
Posted by Manjula Kutty <ma...@gmail.com>.
Thanks Dan, This RunScript works for me
-Manjula
On 12/20/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> Manjula Kutty wrote:
> > Thanks Dan. But still I'm getting the same error.
>
> Can you use the other runScript method?
>
> E.g. something like:
>
> runScript("org/apache/derbyTesting/<path to your script>", "US-ASCII");
>
> This works for script files that are in derbyTesting.jar or the classpath.
>
> Dan.
>
--
Thanks,
Manjula.
Re: File Permission for ij tests
Posted by Daniel John Debrunner <dj...@apache.org>.
Manjula Kutty wrote:
> Thanks Dan. But still I'm getting the same error.
Can you use the other runScript method?
E.g. something like:
runScript("org/apache/derbyTesting/<path to your script>", "US-ASCII");
This works for script files that are in derbyTesting.jar or the classpath.
Dan.
Re: File Permission for ij tests
Posted by Manjula Kutty <ma...@gmail.com>.
Thanks Dan. But still I'm getting the same error. I changed the code like
this
public void testDataPopulation() throws SQLException {
String[] dbfiles = {"ToursDB_schema.sql","loadTables.sql"};
BufferedInputStream inStream;
// Connection conn = getConnection();
try{
for (int i = 0 ; i < dbfiles.length ; i++)
{
inStream = new BufferedInputStream(new
FileInputStream(dbfiles[i]),
utilMain.BUFFEREDFILESIZE);
runScript(inStream, "US-ASCII");
}
} catch (Exception e) {
fail("Unexpected while populating the data" + e.getMessage
());
}
}
Still getting the same Exception.
-Manjula
On 12/19/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> Manjula Kutty wrote:
> > Hi,
> >
> > I was trying to convert the test demo/checkToursDB.java to junit and I
> > came throug this error. Does any one know how to resolve this issue?
>
> BaseJDBCTestCase has utility methods to run sql scripts, see the
> runScript methods in the class.
>
> Dan.
>
--
Thanks,
Manjula.
Re: File Permission for ij tests
Posted by Daniel John Debrunner <dj...@apache.org>.
Manjula Kutty wrote:
> Hi,
>
> I was trying to convert the test demo/checkToursDB.java to junit and I
> came throug this error. Does any one know how to resolve this issue?
BaseJDBCTestCase has utility methods to run sql scripts, see the
runScript methods in the class.
Dan.