[ 
https://issues.apache.org/jira/browse/KARAF-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukas Roedl updated KARAF-2388:
-------------------------------

    Description: 
Following the manual at 
http://karaf.apache.org/manual/latest-2.3.x/developers-guide/writing-tests.html#KarafDistributionConfigurationOption
 I tried to write integration tests based on a custom Karaf distribution.
I used the following to configure the container:

{code:java}
...
karafDistributionConfiguration()
        .frameworkUrl(
                        maven()
                        .groupId("at.ac.ait.hbs.homer")
                        
.artifactId("at.ac.ait.hbs.homer.core.distribution.assemblies.stable")
                        .type("zip")
                        .versionAsInProject()
        )
        .karafVersion(KARAF_VERSION)
        .name("Apache Karaf")
        .unpackDirectory(new File(UNPACK_DIRECTORY)),
...
{code}

When running the tests I get an "No karaf base dir found in extracted 
distribution." error. When looking into the "target\exam\<random>\" folder (= 
UNPACK_DIRECTORY) there is really a mess:

{code}
DISCLAIMER.txt
LICENSE.txt
README.txt
...
bin\
...
config.properties
custom.properties
endorsed\
ext\
...
karaf.bat
karaf.jar
keys.properties
org\
...
system.properties
tmp\
users.properties
{code}

What I expected was the default Karaf distribution layout:

{code}
bin\
data\
demo\
deploy\
etc\
lib\
system\
README
karaf-manual-2.3.2.html
karaf-manual-2.3.2.pdf
...
{code}

Digging into the problem I found out that the eg. the apache-karaf-2.3.2.zip 
looks like:

{code}
apache-karaf-2.3.2\bin\
apache-karaf-2.3.2\data\
apache-karaf-2.3.2\demo\
apache-karaf-2.3.2\deploy\
apache-karaf-2.3.2\etc\
apache-karaf-2.3.2\lib\
apache-karaf-2.3.2\system\
apache-karaf-2.3.2\README
apache-karaf-2.3.2\karaf-manual-2.3.2.html
apache-karaf-2.3.2\karaf-manual-2.3.2.pdf
...
{code}

Whereas the custom distribution I'm using looks like:

{code}
bin\
data\
demo\
deploy\
etc\
lib\
system\
README
karaf-manual-2.3.2.html
karaf-manual-2.3.2.pdf
...
{code}

Not the different "base" directory in the two packages - "apache-karaf-2.3.2" 
in case of the Karaf 2.3.2 assembly.
It seems that the container assumes that every zip/tar.gz file given has this 
"base" directory structure and extracts only the contents of subfolders to the 
unpack directory.

I think a check for this "base" directory should be integrated in the container 
and either extract only the contents in this "base" directory or extract the 
whole file otherwise - the base directory seems to have the same name as the 
artifact name?!

If you want to try it out you can get the distribution from 
http://dev.arcsmed.at/nexus/content/repositories/homer.core-snapshots/at/ac/ait/hbs/homer/at.ac.ait.hbs.homer.core.distribution.assemblies.stable/1.2.0-SNAPSHOT/

  was:
Following the manual at 
http://karaf.apache.org/manual/latest-2.3.x/developers-guide/writing-tests.html#KarafDistributionConfigurationOption
 I tried to write integration tests based on a custom Karaf distribution.
I used the following to configure the container:

{code:java}
...
karafDistributionConfiguration()
        .frameworkUrl(
                        maven()
                        .groupId("at.ac.ait.hbs.homer")
                        
.artifactId("at.ac.ait.hbs.homer.core.distribution.assemblies.stable")
                        .type("zip")
                        .versionAsInProject()
        )
        .karafVersion(KARAF_VERSION)
        .name("Apache Karaf")
        .unpackDirectory(new File(UNPACK_DIRECTORY)),
...
{code}

When running the tests I get an "No karaf base dir found in extracted 
distribution." error. When looking into the "target\exam\<random>\" folder (= 
UNPACK_DIRECTORY) there is really a mess:

{code}
DISCLAIMER.txt
LICENSE.txt
README.txt
...
bin\
...
config.properties
custom.properties
endorsed\
ext\
...
karaf.bat
karaf.jar
keys.properties
org\
...
system.properties
tmp\
users.properties
{code}

What I expected was the default Karaf distribution layout:

{code}
bin\
data\
demo\
deploy\
etc\
lib\
system\
README
karaf-manual-2.3.2.html
karaf-manual-2.3.2.pdf
...
{code}

Digging into the problem I found out that the eg. the apache-karaf-2.3.2.zip 
looks like:

{code}
apache-karaf-2.3.2\bin\
apache-karaf-2.3.2\data\
apache-karaf-2.3.2\demo\
apache-karaf-2.3.2\deploy\
apache-karaf-2.3.2\etc\
apache-karaf-2.3.2\lib\
apache-karaf-2.3.2\system\
apache-karaf-2.3.2\README
apache-karaf-2.3.2\karaf-manual-2.3.2.html
apache-karaf-2.3.2\karaf-manual-2.3.2.pdf
...
{code}

Whereas the custom distribution I'm using looks like:

{code}
bin\
data\
demo\
deploy\
etc\
lib\
system\
README
karaf-manual-2.3.2.html
karaf-manual-2.3.2.pdf
...
{code}

Not the different "base" directory in the two packages - "apache-karaf-2.3.2" 
in case of the Karaf 2.3.2 assembly.
It seems that the container assumes that every zip/tar.gz file given has this 
"base" directory structure and extracts only the contents of subfolders to the 
unpack directory.

I think a check for this "base" directory should be integrated in the container 
and either extract only the contents in this "base" directory or extract the 
whole file otherwise - the base directory seems to have the same name as the 
artifact name?!

    
> Error "No karaf base dir found in extracted distribution." when using 
> customized Karaf distribution
> ---------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-2388
>                 URL: https://issues.apache.org/jira/browse/KARAF-2388
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-exam
>    Affects Versions: 2.3.2, 3.0.0.RC1
>            Reporter: Lukas Roedl
>
> Following the manual at 
> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/writing-tests.html#KarafDistributionConfigurationOption
>  I tried to write integration tests based on a custom Karaf distribution.
> I used the following to configure the container:
> {code:java}
> ...
> karafDistributionConfiguration()
>       .frameworkUrl(
>                       maven()
>                       .groupId("at.ac.ait.hbs.homer")
>                       
> .artifactId("at.ac.ait.hbs.homer.core.distribution.assemblies.stable")
>                       .type("zip")
>                       .versionAsInProject()
>       )
>       .karafVersion(KARAF_VERSION)
>       .name("Apache Karaf")
>       .unpackDirectory(new File(UNPACK_DIRECTORY)),
> ...
> {code}
> When running the tests I get an "No karaf base dir found in extracted 
> distribution." error. When looking into the "target\exam\<random>\" folder (= 
> UNPACK_DIRECTORY) there is really a mess:
> {code}
> DISCLAIMER.txt
> LICENSE.txt
> README.txt
> ...
> bin\
> ...
> config.properties
> custom.properties
> endorsed\
> ext\
> ...
> karaf.bat
> karaf.jar
> keys.properties
> org\
> ...
> system.properties
> tmp\
> users.properties
> {code}
> What I expected was the default Karaf distribution layout:
> {code}
> bin\
> data\
> demo\
> deploy\
> etc\
> lib\
> system\
> README
> karaf-manual-2.3.2.html
> karaf-manual-2.3.2.pdf
> ...
> {code}
> Digging into the problem I found out that the eg. the apache-karaf-2.3.2.zip 
> looks like:
> {code}
> apache-karaf-2.3.2\bin\
> apache-karaf-2.3.2\data\
> apache-karaf-2.3.2\demo\
> apache-karaf-2.3.2\deploy\
> apache-karaf-2.3.2\etc\
> apache-karaf-2.3.2\lib\
> apache-karaf-2.3.2\system\
> apache-karaf-2.3.2\README
> apache-karaf-2.3.2\karaf-manual-2.3.2.html
> apache-karaf-2.3.2\karaf-manual-2.3.2.pdf
> ...
> {code}
> Whereas the custom distribution I'm using looks like:
> {code}
> bin\
> data\
> demo\
> deploy\
> etc\
> lib\
> system\
> README
> karaf-manual-2.3.2.html
> karaf-manual-2.3.2.pdf
> ...
> {code}
> Not the different "base" directory in the two packages - "apache-karaf-2.3.2" 
> in case of the Karaf 2.3.2 assembly.
> It seems that the container assumes that every zip/tar.gz file given has this 
> "base" directory structure and extracts only the contents of subfolders to 
> the unpack directory.
> I think a check for this "base" directory should be integrated in the 
> container and either extract only the contents in this "base" directory or 
> extract the whole file otherwise - the base directory seems to have the same 
> name as the artifact name?!
> If you want to try it out you can get the distribution from 
> http://dev.arcsmed.at/nexus/content/repositories/homer.core-snapshots/at/ac/ait/hbs/homer/at.ac.ait.hbs.homer.core.distribution.assemblies.stable/1.2.0-SNAPSHOT/

--
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

Reply via email to