@Override
  public Resource createResource(String resourceName, String libraryName) {
    Resource resource = wrapped.createResource(resourceName, libraryName);

    if (activated && resource != null && libraryName != null && LIBRARY.equals(libraryName)) {
      if (ProjectStageProducer.getInstance().getProjectStage() == ProjectStage.Development) {
        resource = wrapped.createResource(resourceName, LIBRARY_UNCOMPRESSED);
      }

      resource = new DeltaSpikeResource(resource, version);
    }

    return resource;
  }
  /**
   * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other
   * archives.
   */
  @Deployment
  public static WebArchive deploy() {
    System.setProperty("org.apache.deltaspike.ProjectStage", "Development");
    ProjectStageProducer.setProjectStage(null);

    return ShrinkWrap.create(WebArchive.class)
        .addAsLibraries(
            ShrinkWrapArchiveUtil.getArchives(
                null,
                "META-INF/beans.xml",
                new String[] {
                  "org.apache.deltaspike.core", "org.apache.deltaspike.test.core.api.exclude"
                },
                null))
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
  }
 @Before
 public void init() {
   ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
 }
 /** check project-stage to ensure the correct config for the other tests in this class */
 @Test
 public void checkProjectStage() {
   Assert.assertEquals(
       ProjectStage.IntegrationTest, ProjectStageProducer.getInstance().getProjectStage());
 }