0 Replies Latest reply on Feb 8, 2016 11:43 AM by jldw

    Wildfly + gradle exceptions

    jldw

      I've written this gradle script: https://gist.github.com/anonymous/ba7de8e301eef7be3f3c

       

      When I run my test, gradle warns me about some dependencies:

      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.interceptor.GlobalInterceptorExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.interceptor.GlobalInterceptorExtension
      WARN: JBAS016006: Could not load portable extension class org.jboss.weld.environment.se.WeldSEBeanRegistrant java.lang.ClassNotFoundException: org.jboss.weld.environment.se.WeldSEBeanRegistrant
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.jmx.MBeanExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.jmx.MBeanExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.config.ConfigurationExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.config.ConfigurationExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.message.MessageBundleExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.message.MessageBundleExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension java.lang.ClassNotFoundException: org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension
      WARN: JBAS016006: Could not load portable extension class org.apache.deltaspike.core.api.provider.BeanManagerProvider java.lang.ClassNotFoundException: org.apache.deltaspike.core.api.provider.BeanManagerProvider

       

      I'm not able to figure out what's going wrong.

       

      My Test class is:

       

      package com.living.features.arquillian;
      
      import static org.hamcrest.Matchers.equalTo;
      import static org.hamcrest.Matchers.hasItems;
      import static org.hamcrest.Matchers.hasProperty;
      import static org.hamcrest.Matchers.hasSize;
      import static org.junit.Assert.assertThat;
      import static org.junit.Assert.fail;
      import java.util.Arrays;
      
      import javax.inject.Inject;
      
      import org.jboss.arquillian.container.test.api.Deployment;
      import org.jboss.arquillian.junit.Arquillian;
      import org.jboss.shrinkwrap.api.ShrinkWrap;
      import org.jboss.shrinkwrap.api.gradle.archive.importer.embedded.EmbeddedGradleImporter;
      import org.jboss.shrinkwrap.api.spec.JavaArchive;
      import org.jboss.shrinkwrap.api.spec.WebArchive;
      import org.jboss.shrinkwrap.resolver.api.maven.Maven;
      import org.junit.Test;
      import org.junit.runner.RunWith;
      
      import com.living.authz.oauth.persistence.repository.exceptions.RepositorySystemException;
      import com.living.mock.ArquillianAlternative;
      import com.living.mock.MockFactory;
      import com.living.rest.dto.FollowUpActivityDTO;
      import com.living.rest.dto.metainfos.values.MetaInfoValueDTO;
      import com.living.rest.dto.metainfos.values.StringMetaInfoValue;
      import com.living.rest.services.FollowUpActivityService;
      import com.living.rest.services.ResourceService;
      
      @RunWith(Arquillian.class)
      public class ArquillianTest
      {
      
          @Inject protected FollowUpActivityService fuaService;
          @Inject protected ResourceService resourceService;
          
          @Deployment
          public static WebArchive createDeployment()
          {    
              System.getProperties().remove("javax.xml.parsers.SAXParserFactory");
              EmbeddedGradleImporter importer = ShrinkWrap.create(EmbeddedGradleImporter.class);
              WebArchive war = importer.forThisProjectDirectory().importBuildOutput().as(WebArchive.class);
              
              war.addClass(ArquillianAlternative.class);
              war.addClass(MockFactory.class);
              
              JavaArchive[] libs = Maven.resolver().resolve("org.mockito:mockito-core:2.0.31-beta").withTransitivity().as(JavaArchive.class);
              war.addAsLibraries(libs);
              
              //System.out.println(war.toString(true));
              
              return war;
              
      //        return ShrinkWrap.create(WebArchive.class)
      //            .addClass(FollowUpActivityDTO.class)
      //            .addClass(FollowUpActivityService.class)
      //            .addClass(ResourceService.class)
      //            .addPackage(ElasticsearchApplicationResources.class.getPackage())
      //            .addClasses(FollowUpActivityRepository.class, ResourceRepository.class, SettingsPropertiesProducer.class)
      //            //ResourceRepository.class, SettingsPropertiesProducer.class
      //            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
          }
          
      //    @Produces
      //    @Alternative
      //    @Specializes
      //    public UserRequestResources getTestBean() {
      //        UserRequestResources userResources = mock(UserRequestResources.class);
      //        when(userResources.getMe()).thenReturn(new com.living.persistence.entities.User("user_id", "living_team", "", "", "", ""));
      //        
      //        return userResources;
      //    }
          
          @Test
          public void categorize()
          {
              FollowUpActivityDTO receivedFuaDTO = new FollowUpActivityDTO();
              receivedFuaDTO.setId("idFuaCategorize");
              
              MetaInfoValueDTO receivedMetaInfoValue = new StringMetaInfoValue("key", "value");
              
              try {
                  this.fuaService.createOrUpdate(receivedFuaDTO);
                  this.fuaService.categorize(Arrays.asList(receivedFuaDTO.getId()), Arrays.asList(receivedMetaInfoValue));
                  
                  FollowUpActivityDTO categorizedFuaDto = this.fuaService.findOne(receivedFuaDTO.getId());
                  assertThat(categorizedFuaDto.getMetainfos(), hasSize(1));
                  
                  assertThat(categorizedFuaDto.getMetainfos(), hasItems(
                                                                  hasProperty("key", equalTo(receivedMetaInfoValue.getKey())),
                                                                  hasProperty("value", equalTo(receivedMetaInfoValue.getValue()))
                                                              ));
                  
              } catch (RepositorySystemException e) {
                  fail(e.getMessage());
              }
          }
      }