[Dev] [DEV][URGENT]OutputAttributeExecutor may produce wrong type of attribute for the output stream in CEP 2.1.0

2013-05-21 Thread Yangjin Wu
 Hi all,
Recently, I've found something wrong in CEP query output attribute executors.
In DivideExpressionExecutorLong.java, the execute method was written as
-
public Object execute(AtomicEvent event) {
return ((Number) leftExpressionExecutor.execute(event)).doubleValue() / 
((Number) rightExpressionExecutor.execute(event)).doubleValue();
}
-
hence, the result of the output Object is of type Double, but this particular 
executor requires output type Long.  All executors under the divide category
suffers from this issue.  The consequence is to cause a java cast exception 
when the wrong type of attribute occurs in the output stream, and the attribute
is used in the followed queries.
Hope this will be fixed, thanks.


Yangjin Wu
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] AND query bug in CEP 2.0.0

2013-04-10 Thread Yangjin Wu
 Hi all,

   I am testing the LogicPattern(AND) in CEP using the following query:

frome1 = Stream2[price  70] and
e2 = Stream2[symbol == IBM] -
e3 = Stream1[price  70]
insert into OutStream
e1.symbol as symbol1, e2.price as symbol2, e3.price as symbol3

and send events like this:
stream2.send(new Object[]{GOOG, 72.7f, 100});
Thread.sleep(500);
stream1.send(new Object[]{WSO2, 55.6f, 100});
Thread.sleep(500);
when the second event sends,then the projector sends outstream event,but 
actually the logic and condition doesn't match.

Is it a bug?

Thanks in advance for your help!

Regards,

below is the test function code:


@Test
public void testQuery4() throws InterruptedException {
log.info(testPatternLogic4 - OUT 1);

SiddhiManager siddhiManager = new SiddhiManager();


siddhiManager.defineStream(QueryFactory.createStreamDefinition().name(Stream1).attribute(symbol,
 Attribute.Type.STRING).attribute(price, 
Attribute.Type.FLOAT).attribute(volume, Attribute.Type.INT));

siddhiManager.defineStream(QueryFactory.createStreamDefinition().name(Stream2).attribute(symbol,
 Attribute.Type.STRING).attribute(price, 
Attribute.Type.FLOAT).attribute(volume, Attribute.Type.INT));

Query query = QueryFactory.createQuery();
query.from(
QueryFactory.patternStream(
Pattern.followedBy(
Pattern.logical(
QueryFactory.inputStream(e1, 
Stream2).filter(

Condition.compare(Expression.variable(price),
  
Condition.Operator.GREATER_THAN,
  
Expression.value(70))),
LogicalElement.Type.AND,
QueryFactory.inputStream(e2, 
Stream2).filter(

Condition.compare(Expression.variable(symbol),
  
Condition.Operator.EQUAL,
  
Expression.value(IBM,
QueryFactory.inputStream(e3, 
Stream1).filter(

Condition.compare(Expression.variable(price),
  
Condition.Operator.GREATER_THAN,
  
Expression.value(20));

query.insertInto(OutStream);
query.project(
QueryFactory.outputProjector().
project(symbol1, Expression.variable(e1, symbol)).
project(symbol2, Expression.variable(e2, price)).
project(symbol3, Expression.variable(e3, price))

);


String queryReference= siddhiManager.addQuery(query);
siddhiManager.addCallback(queryReference, new QueryCallback() {
@Override
public void receive(long timeStamp, Event[] inEvents, Event[] 
removeEvents) {
EventPrinter.print(timeStamp, inEvents, removeEvents);
Assert.assertArrayEquals(new Object[]{WSO2, 72.7f, 4.7f}, 
inEvents[0].getData());
eventCount++;
eventArrived = true;
}
});
InputHandler stream1 = siddhiManager.getInputHandler(Stream1);
InputHandler stream2 = siddhiManager.getInputHandler(Stream2);
stream2.send(new Object[]{GOOG, 72.7f, 100});
Thread.sleep(500);
stream1.send(new Object[]{WSO2, 55.6f, 100});
Thread.sleep(500);
stream2.send(new Object[]{IBM, 4.7f, 100});
Thread.sleep(500);
stream1.send(new Object[]{WSO2, 55.6f, 100});
Thread.sleep(500);

siddhiManager.shutdown();

Assert.assertEquals(Number of success events, 1, eventCount);
Assert.assertEquals(Event arrived, true, eventArrived);

}

);

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Urgent: Need help

2013-03-11 Thread Yangjin Wu
Hi,
As a starter on carbon platform, I encountered problems when I tried to import 
the carbon kernel source tree 4.0.0 into eclipse.
I tried to accomplish the task in two ways:
a) I used maven eclipse plugin to convert the carbon kernel project into the 
eclipse project with the command,
mvn eclipse:eclipse
and then I imported the project as an existing eclipse project with 
sts-3.1.0 (spring source tool-suite).
However, the projects imported contain lots of build path issues (most of 
them are missing project dependencies) which is hard
to correct them all by hand.  It seems that the aggregated pure pom project 
could not bring its sub-projects out as eclipse projects
hence the project missing errors in the build path.
b) I used eclipse plugin m2e to import the source code as a maven project.  In 
the process, a dozen of maven plugins reported errors.

I am wondering how you guys do the software development for carbon kernel since 
the source code should be imported into eclipse first anyway.
Besides, is there any reference guide for developers, especially newcomers?  
Thanks a lot.

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problems importing WSO2 kernel as Maven project into Eclipse

2013-02-25 Thread Yangjin Wu
Hi, Nirmal,

In fact, I already did the same thing as you described.  The 
maven-eclipse-plugin 2.9 seems to do the work with the command
mvn eclipse:eclipse -Dwtpversion=2.0
I have checked the generated .classpath file in the root of each subproject, I 
found that the dependencies are added correctly.
Since the whole is a maven multi-module project, I tried to import it into 
eclipse from the top-level, what I found was that the project with multiple
modules could not be imported correctly.  And the imported projects were not in 
the form of a hierarchical view.  That seems strange to me for that
all projects should form a hierarchical view.  Any advices?
Thanks.






At 2013-02-26 11:38:33,Nirmal Fernando nir...@wso2.com wrote:

Hi,


Use mvn eclipse:eclipse and this will generate the Eclipse project files to 
you. Then import the directory from Eclipse, and Eclipse will identify your 
project.


Hope this helps.




On Tue, Feb 26, 2013 at 7:46 AM, wuyjnuaa wuyjn...@126.com wrote:

 
Hi there,


I tried to  import WSO2 kernel as Maven project into Eclipse, however, there 
are all sorts of build path problems, in particular, couldn't locate the 
necessary libraries.


FYI, I use Spring STS with m2eclipse plugin, and checkout source code from 
https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.0.0/.


Could anyone point me to a developer guide or any documentation of how to 
develop/extend WSO2 kernel, and how to add/remove bundles when it's necessary.


Thanks in advance.



___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev





--

Thanks  regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev