CitrusArchiveAppender extends CachedAuxilliaryArchiveAppender { @Override protected Archive<?> buildArchive() { return ShrinkWrap.create(JavaArchive.class) .addClass(CitrusExtensionConstants.class) .addClass(CitrusConfiguration.class) .addClass(CitrusTestEnricher.class) .addClass(CitrusRemoteInstanceProducer.class) .addClass(CitrusRemoteLifecycleHandler.class) .addClass(CitrusRemoteConfigurationProducer.class) .addClass(CitrusRemoteExtension.class) .addPackage(ReflectionUtils.class.getPackage()) .addAsResource(new StringAsset(configurationInstance.get().toString()), CitrusExtensionConstants.CITRUS_REMOTE_PROPERTIES) .addAsServiceProvider(RemoteLoadableExtension.class, CitrusRemoteExtension.class); }    }
@Test public void testBuildArchive() throws Exception { CitrusConfiguration configuration = CitrusConfiguration.from(new Properties()); Instance<CitrusConfiguration> configurationInstance = Mockito.mock(Instance.class); when(configurationInstance.get()).thenReturn(configuration); InjectionHelper.inject(archiveAppender, "configurationInstance", configurationInstance); Archive archive = archiveAppender.createAuxiliaryArchive(); Assert.assertNotNull(archive); Assert.assertTrue(archive instanceof JavaArchive); for (Class required : REQUIRED_CLASSES) { Assert.assertTrue(archive.contains(getArchivePath(required)), String.format("Missing required class '%s' in auxiliary archive", required)); } Assert.assertTrue(archive.contains("/" + CitrusExtensionConstants.CITRUS_REMOTE_PROPERTIES)); }