why not creating an initial context? new InitialContext instead of arquillianContext?
*Romain Manni-Bucau* *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/1/10 Luca Merolla <luca.mero...@gmail.com> > I have some EJBs which are secured with @RolesAllowed("admin") > > And I'm trying to perform an authentication in the unit test otherwise it > fails because I'm not allowed. > Basically the method in the example is using this method: > > private Context login(final String username, final String password) { > // Precondition checks > assert username != null : "username must be supplied"; > assert password != null : "password must be supplied"; > > // Log in and create a context > final Map<String, Object> namingContextProps = new HashMap<String, > Object>(); > namingContextProps.put(Context.SECURITY_PRINCIPAL, username); > namingContextProps.put(Context.SECURITY_CREDENTIALS, password); > final Context context = arquillianContext.get(Context.class, > namingContextProps); > > // Return > return context; > } > > > On Thu, Jan 10, 2013 at 12:35 AM, Romain Manni-Bucau > <rmannibu...@gmail.com>wrote: > > > sorry i didn't get your question > > > > maybe cause i don't know ArquillianContext but it doesn't look an > upstream > > change. > > > > what's the really issue (why you need it)? > > > > *Romain Manni-Bucau* > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > > *Blog: **http://rmannibucau.wordpress.com/*< > > http://rmannibucau.wordpress.com/> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > > *Github: https://github.com/rmannibucau* > > > > > > > > 2013/1/10 Luca Merolla <luca.mero...@gmail.com> > > > > > Hi everyone, > > > > > > I'm trying to get Arquillian up and running with some secured EJBs. > > > > > > I have followed this example which is using the class ArquillianContext > > > > > > > > > > > > https://github.com/ALRubinger/oreilly-ejb-6thedition-book-examples/blob/master/ch15-secureschool/src/test/java/org/jboss/ejb3/examples/ch15/secureschool/SecureSchoolIntegrationTest.java > > > > > > these are my maven test dependencies > > > > > > <!-- Testing --> > > > <dependency> > > > <groupId>junit</groupId> > > > <artifactId>junit</artifactId> > > > <version>${junit.version}</version> > > > <scope>test</scope> > > > </dependency> > > > <dependency> > > > <groupId>org.apache.openejb</groupId> > > > <artifactId>tomee-embedded</artifactId> > > > <version>${tomee.version}</version> > > > <scope>test</scope> > > > </dependency> > > > <dependency> > > > <groupId>org.apache.openejb</groupId> > > > <artifactId>arquillian-tomee-embedded</artifactId> > > > <version>${tomee.version}</version> > > > <scope>test</scope> > > > </dependency> > > > <dependency> > > > <groupId>org.jboss.arquillian.junit</groupId> > > > <artifactId>arquillian-junit-container</artifactId> > > > </dependency> > > > <dependency> > > > <groupId>org.jboss.arquillian.protocol</groupId> > > > <artifactId>arquillian-protocol-servlet</artifactId> > > > <scope>test</scope> > > > </dependency> > > > <dependency> > > > <groupId>org.jboss.shrinkwrap.resolver</groupId> > > > <artifactId>shrinkwrap-resolver-depchain</artifactId> > > > <version>2.0.0-alpha-6</version> > > > <type>pom</type> > > > </dependency> > > > > > > however, I think ArquillianContext is in this one > > > > > > <dependency> > > > <groupId>org.jboss.arquillian.container</groupId> > > > <artifactId>arquillian-openejb-embedded-3.1</artifactId> > > > <version>1.0.0.Alpha5</version> > > > <scope>test</scope> > > > </dependency> > > > > > > but when I add arquillian-openejb-embedded-3.1 I get the following > error > > > when I'm running the junit test: > > > > > > Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api > > type > > > [org.jboss.arquillian.prototyping.context.api.ArquillianContext] is not > > > found with the qualifiers > > > Qualifiers: [@javax.enterprise.inject.Default()] > > > > > > I'm using TomEE 1.5.1. Is there a different approach to solve this > > problem, > > > or it's my configuration that is wrong? > > > > > > Thanks in advance, > > > LM > > > > > >