apex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chinmay Kolhatkar <chin...@apache.org>
Subject Re: Unit tests not picking maven dependencies for LocalMode
Date Fri, 22 Apr 2016 08:26:27 GMT
I believe this is a transitive dependency problem.
opencsv is added as dependency to Module C pom but not in application pom.
Can you add the opencsv dependency to application pom, and then try to
compile and run it?

- Chinmay.


On Fri, Apr 22, 2016 at 12:58 PM, Ananth Gundabattula <
agundabattula@gmail.com> wrote:

> Hello Chinmay,
>
> Here is the pom snippet :
>
> <dependency>
>     <groupId>net.sf.opencsv</groupId>
>     <artifactId>opencsv</artifactId>
>     <version>${open-csv-version}</version>
> </dependency>
>
>
> The dependency is being injected via this module dependency:
>
> Apex Application (main module )  => Module B => Module C => opencsv (
> dependency above).
>
> I guess I need to also share with you the fact that a part of the
> application logic framework is being booted up by using a spring context.
> The Apex app in the operator tries to "inject a Spring Context" and pull
> out a bean that uses the OpenCSV class inside it. The class that is
> obtained as a bean is then used in the process method of the operator.
>
> eventDetailsStatementGenerator = (EventDetailsStatementGenerator)
>         CassandraEventDetailsAppContext.getCassandraEventDetailsAppContext()
>                 .getIOCContext().getBean(DWHAppBeanNames.EVENTDETAILS_STMT_GENERATOR_BEAN_NAME);
>
>
> The above method is being called in the activate() method of the operator.
> The operator uses a SpringContext booted up via a
> AnnotationApplicationConfig class from Spring.
>
>
>
> Regards,
> Ananth
>
> On Fri, Apr 22, 2016 at 5:11 PM, Chinmay Kolhatkar <chinmay@apache.org>
> wrote:
>
>> Hi Ananth,
>>
>> You can have a full cycle of run in local mode for apex app. This seems
>> to be a dependency related issue.
>>
>> Can you please share the code snippet of pom.xml where the missing maven
>> dependency is added?
>> Also, are you trying the load a class from that jar dependency using any
>> class loader?
>>
>> Thanks,
>> Chinmay.
>>
>>
>> On Fri, Apr 22, 2016 at 12:24 PM, Ananth Gundabattula <
>> agundabattula@gmail.com> wrote:
>>
>>>
>>> Hello All,
>>>
>>> Some of my unit tests are not able to execute a flow end to end because
>>> a jar is not being picked up at runtime though  it is part of the maven
>>> dependencies etc …
>>>
>>> I believe in the actual scenario when deploying it to an Apex server,
>>> the metadata file that is used in packaging the application artefacts
>>> specifies an application path etc. However in my unit tests , this does not
>>> seem to apply/take effect. Am I right in assuming that we cannot achieve a
>>> full cycle of run using the local mode setup of the Apex app in a unit test
>>> ?
>>>
>>> Are there any recommendations to get around this issue ?
>>>
>>> Here is the code snippet that I am trying :
>>>
>>> @Test
>>> public void testApplication() throws IOException, Exception {
>>>     try {
>>>         LocalMode lma = LocalMode.newInstance();
>>>         Configuration conf = new Configuration(false);
>>>         conf.addResource(this.getClass().getResourceAsStream("/dag-test-props.xml"));
>>>         lma.prepareDAG(new CassandraEventDetailsStreamingApp(), conf);
>>>         LocalMode.Controller lc = lma.getController();
>>>         lc.run();
>>>     } catch (ConstraintViolationException e) {
>>>         Assert.fail("constraint violations: " + e.getConstraintViolations());
>>>     }
>>> }
>>>
>>>
>>>
>>> Regards,
>>> Ananth
>>>
>>
>>
>

Mime
View raw message