Hi,

looks like you have a dependency on a artifact which is only available from
artifactory or it is a snapshot dependency and your configuration in the
settings.xml provides the info to update on every request?

make sure you have the dependency localy available, so maybe a maven build
prior to the test should help already.

regards, Achim


2016-07-11 2:15 GMT+02:00 Tony Zhang <[email protected]>:

> I am new to PAX-EXAM, so please pardon me if my question is too obvious.
>
> I created a new project to test my OSGi bundles.
> The pom.file is attached.
>
> My test case is simple,
> --------------------
> import static org.ops4j.pax.exam.CoreOptions.*;
> import static org.junit.Assert.*;
>
> import org.junit.Test;
> import org.junit.runner.RunWith;
> import org.ops4j.pax.exam.Configuration;
> import org.ops4j.pax.exam.Option;
> import org.ops4j.pax.exam.junit.PaxExam;
> import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
> import org.ops4j.pax.exam.spi.reactors.PerMethod;
>
> import com.sun.jersey.api.client.Client;
> import com.sun.jersey.api.client.WebResource;
>
> @RunWith(PaxExam.class)
> @ExamReactorStrategy(PerMethod.class)
> public class MyNewTest {
>     @Configuration
>     public *Option*[] config() {
>         return options(
>             systemProperty("org.osgi.service.http.port").value("8080"),
>
> mavenBundle().groupId("abc").artifactId("abc-identity-service").version("1.0-SNAPSHOT"),
>
> mavenBundle().groupId("abc").artifactId("abc-example-service").version("1.0-SNAPSHOT"),
>             junitBundles()
>             );
>     }
>
>     @Test
>     public void *testAnonymousVist*(){
>         Client client = Client.create();
>         WebResource resource = client.resource("
> http://localhost:8080/osgi/example/hello";);
>         String response = resource.get(String.class);
>         logger.info(response);
>         assertEquals(response, "hello anonymous");
>     }
> }
> --------------------
> I am using the NativeContainer.
> When I run "mvn clean install", I got the following error:
>
> testAnonymousVist(abc.example.identity.MyNewTest)  Time elapsed: 0.703 sec
>  <<< ERROR!
> java.lang.IllegalStateException: Stream handler unavailable due to: For
> input string:* "[email protected]
> <[email protected]>"*
>
>
> Results :
>
> Tests in error:
>   MyNewTest.testAnonymousVist ? IllegalState Stream handler unavailable
> due to: ...
>
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test
> (default-test) on project abc-example-test: There are test failures.
>
> Please refer to ....\example-test\target\surefire-reports for the
> individual test results.
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
>         at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: org.apache.maven.plugin.MojoFailureException: There are test
> failures.
>
> Please refer to ....\example-test\target\surefire-reports for the
> individual test results.
>         at
> org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:91)
>         at
> org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:318)
>         at
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:880)
>         at
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:739)
>         at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
>         ... 20 more
>
> --------------------
>
> The input string (*[email protected]
> <[email protected]>*) shows my password and *artifactory *of
> my company from *settings.xml*.
> *I do not know why it uses my password to contact my
> company's artifactory.*
> I only want to test the basic functions of two installed bundles (which
> are abc-identity-service and abc-example-service, shown in the
> configuration function).
>
> Could you tell me what I need to do, to get rid of this error, and solely
> test the function without calling my company's artifactory.
> Thank you for any inputs.
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to