Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Java-SCA-0.99
-
None
-
WINXP IBMJDK5
Description
Seemly ServiceReference.getConversationID() works incorrect. It always return null. see below code(I tried it on release 0.99):
1. @Test
2. public void testServiceRef()
From Line 1 - 11, all things work correctly. But LI 12 fails. cartRef.getConversationID() should return a non-null value since the conversation has been started.
The component:
<component name="CartComponent">
<implementation.java class="samples.hex.cart.impl.CartImpl"/>
</component>
The Interface:
package samples.hex.cart.services;
import java.util.Map;
import org.osoa.sca.annotations.Conversational;
import org.osoa.sca.annotations.EndsConversation;
@Conversational
public interface CartService{
public void updateItem(String itemID, int quantity);
@EndsConversation
public void empty();
public Map<String, Integer> getItems();
}
The Implementation:
package samples.hex.cart.impl;
import java.util.HashMap;
import java.util.Map;
import org.osoa.sca.annotations.ConversationAttributes;
import org.osoa.sca.annotations.ConversationID;
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
import samples.hex.cart.services.CartService;
@Scope("CONVERSATION")
@Service(CartService.class)
@ConversationAttributes(maxIdleTime="1 seconds",
maxAge="2 seconds",
singlePrincipal=false)
public class CartImpl implements CartService {
@ConversationID
protected String conversationID;
private Map<String, Integer> cart;
@Init
protected void init()
public void empty()
{ System.out.println("[empty] "+conversationID + ":" + this); }public Map<String, Integer> getItems()
{ return cart; }public void updateItem(String itemID, int quantity)
{ if(quantity<=0) cart.remove(itemID); cart.put(itemID, quantity); System.out.println(conversationID + ":" + this); } @Destroy
protected void destroy()
}
–
Cheers
Jun Jie Nan
∧ ∧︵
ミ^ō^ミ灬)~