Hi Gerhard,
"#3 per default the bundle needs to be in the same package as the
interface."

O do not have MessageContextConfig and it works with bundle in default
resources package (src/main/resources/messages.properties).

It shouldnt work?

The only problem is with tests.

2015-04-02 13:26 GMT-03:00 Gerhard Petracek <[email protected]>:
>
> hi rafael,
>
> #1 and #2 is the normal setup - there is nothing unexpected here.
> #3 per default the bundle needs to be in the same package as the
interface.
> (you can specify a different location via
> @MessageContextConfig#messageSource.)
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache
> MyFaces, DeltaSpike and OpenWebBeans
>
>
>
> 2015-04-02 16:10 GMT+02:00 Rafael Pestano <[email protected]>:
>
> > Hi guys,
> >
> > i'm having some problems to create a simple test using test control
module
> > in an EE6 app.
> >
> > Class under test:
> >
> > @MessageBundle
> > public interface Messages {
> >
> >   @MessageTemplate("{label.system-info}")
> >   String systemInfo();
> >
> > }
> >
> >
> > MessagesTest.java
> >
> > @RunWith(CdiTestRunner.class)
> > public class MessagesTest {
> >
> >   @Inject
> >   Messages messages;
> >
> >   @Test
> >   public void deveLerMensagemDoBundle(){
> >     assertEquals(messages.systemInfo(),"System info");
> >   }
> > }
> >
> >
> > 1 - the above dependencies were not sufficient:
> >
> > <dependency>
> >     <groupId>org.apache.deltaspike.modules</groupId>
> >     <artifactId>deltaspike-test-control-module-api</artifactId>
> >     <version>${ds.version}</version>
> >     <scope>test</scope>
> > </dependency>
> > <dependency>
> >     <groupId>org.apache.deltaspike.modules</groupId>
> >     <artifactId>deltaspike-test-control-module-impl</artifactId>
> >     <version>${ds.version}</version>
> >     <scope>test</scope>
> > </dependency>
> > <dependency>
> >     <groupId>org.apache.deltaspike.cdictrl</groupId>
> >     <artifactId>deltaspike-cdictrl-weld</artifactId>
> >     <version>${ds.version}</version>
> >     <scope>test</scope>
> > </dependency>
> >
> >
> > needed to add
> >
> > <dependency>
> >     <groupId>org.jboss.weld.se</groupId>
> >     <artifactId>weld-se-core</artifactId>
> >     <version>2.2.6.Final</version>
> >     <scope>test</scope>
> > </dependency>
> >
> >
> > otherwise i get: java.lang.NoClassDefFoundError:
> > org/jboss/weld/environment/se/Weld
> >
> > 2 - beans.xml in test/resources/META-INF was not suffcient
> >
> > needed to add beans.xml to src/main/resources/META-INF
> >
> > otherwise i get:
> >
> >  WELD-001408: Unsatisfied dependencies for type Messages with qualifiers
> > @Default
> >   at injection point [BackedAnnotatedField] @Inject
> > com.procergs.apm.it.MessagesTest.messages
> >
> > 3 - In the test the line: *messages.systemInfo() *return
> > "???label.system-info???" meaning taht the key was not found in the
message
> > bundle although when running the application the message is found.
> >
> > My messages.properties is located at *src/main/resources*.
> >
> >
> > Any help is appreciated.
> >
> > Thanks in advance.
> >
> >
> >
> > --
> > <http://www.advancedit.com.br/>Att,
> >
> > Rafael M. Pestano
> >
> > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> > http://rpestano.wordpress.com/
> > @realpestano <https://twitter.com/realpestano>
> >


-- 
Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano

Reply via email to