Skip to content

Commit

Permalink
SOLDER-81 make LoggerProducers serializable
Browse files Browse the repository at this point in the history
- make LoggerProducers serializable
- add test
- remove jboss.i18n.generate-proxies from test setup
  • Loading branch information
mojavelinux committed Mar 14, 2011
1 parent 1b150ea commit c2020e4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
Expand Up @@ -23,6 +23,8 @@
import static org.jboss.seam.solder.reflection.Reflections.getRawType;
import static org.jboss.seam.solder.util.Locales.toLocale;

import java.io.Serializable;

import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.InjectionPoint;
Expand All @@ -36,7 +38,7 @@
* @author David Allen
* @author Pete Muir
*/
class LoggerProducers
class LoggerProducers implements Serializable
{
@Produces
Logger produceLog(InjectionPoint injectionPoint)
Expand Down
19 changes: 19 additions & 0 deletions impl/src/test/java/org/jboss/seam/solder/test/log/BaldEagle.java
@@ -0,0 +1,19 @@
package org.jboss.seam.solder.test.log;

import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;

import org.jboss.seam.solder.log.Category;

@SessionScoped
public class BaldEagle implements Serializable {
@Inject @Category("Birds")
private BirdLogger logger;

public void generateLogMessage()
{
logger.logBaldEaglesSpotted(2);
}
}
Expand Up @@ -29,5 +29,8 @@ public interface BirdLogger extends BirdMessages

@LogMessage @Message("Spotted %s Owls")
void logOwlsSpotted(int number);

@LogMessage @Message("Spotted %s Bald Eagles")
void logBaldEaglesSpotted(int number);

}
Expand Up @@ -49,12 +49,6 @@
@RunWith(Arquillian.class)
public class LoggerInjectionTest
{
// TODO temporary, test with dynamic proxies until tool accepts "BirdLogger extends BirdMessages"
static
{
System.setProperty("jboss.i18n.generate-proxies", "true");
}

@Deployment
public static Archive<?> deployment()
{
Expand Down Expand Up @@ -121,6 +115,16 @@ public void testMessageLoggerInjectionWithCategory(Hawk hawk)
{
hawk.generateLogMessage();
}

/**
* BaldEagle declares a passivating scope and therefore must not have any non-serializable dependencies. This test will fail
* deployment if the type-safe logger producer is not serializable. (see SOLDER-81)
*/
@Test
public void testMessageLoggerInjectionOnPassivatingBean(BaldEagle baldEagle)
{
baldEagle.generateLogMessage();
}

@Test
public void testMessageBundleInjection(Jay jay)
Expand Down

0 comments on commit c2020e4

Please sign in to comment.