Re: Unit tests not picking maven dependencies for LocalMode

2016-04-22 Thread Ananth Gundabattula
Hello Chinmay,

Here is the pom snippet :


net.sf.opencsv
opencsv
${open-csv-version}



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 
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 <
> agundabatt...@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
>>
>
>


Re: Unit tests not picking maven dependencies for LocalMode

2016-04-22 Thread Chinmay Kolhatkar
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 <
agundabatt...@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
>