1 Reply Latest reply on Apr 8, 2014 9:48 AM by Alex Soto

    Configuration of an Arquillian Extension

    Alex Soto Newbie

      Hello I am developing an extension and I need that users configure some parameters. I have done next steps:

       

      Create a MocoConfigurator class which listens for arquillian descriptor:

       

          @Inject
          @ApplicationScoped
          private InstanceProducer<MocoConfiguration> configurationProvider;
          
          public void configure(@Observes ArquillianDescriptor arquillianDescriptor) {
              
              Map<String, String> config = arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
              configurationProvider.set(MocoConfiguration.fromMap(config));
          }
      

       

      Then I have added MocoConfiguration class to extension archive:

       

      @Override
        public Archive<?> createAuxiliaryArchive() {
      
         return ShrinkWrap.create(JavaArchive.class, "arquillian-moco.jar")
                    .addClass(ReflectionHelper.class)
                    .addPackage(Moco.class.getPackage())
                    .addPackage(MocoRemoteExtension.class.getPackage())
                    .addClass(MocoConfiguration.class)
                    .addAsServiceProvider(RemoteLoadableExtension.class, MocoRemoteExtension.class);
      
        }
      

       

      Then in extension class I have registered the observer:

       

      @Override
        public void register(ExtensionBuilder builder) {
      
        builder.service(ApplicationArchiveProcessor.class,
        MocoDependencyArchiveProcessor.class);
        builder.service(AuxiliaryArchiveAppender.class,
        MocoArchiveAppender.class);
      
        builder.observer(MocoConfigurator.class);
      
        }
      

       

      The instance is required in container side so I have added next line on a class that is executed in remote side.

       

      @Inject
      private Instance<MocoConfiguration> config;
      

       

       

      The problem is that when I use this code the class is not executed but no error is thrown, but if I comment the previous line and I hardcoded the port then it works, so it seems I have missed something to do so this can work on remote side. Am I wrong= What I have missed?

       

      Thank you so much for your help.

       

      And finally I have added the information inside arquillian.xml (which is configured to use Servlet protocol).

       

      The problem is that although the information is loaded correctly