You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Jun JIe Nan (JIRA)" <tu...@ws.apache.org> on 2007/09/06 01:49:33 UTC

[jira] Created: (TUSCANY-1670) ServiceReference.getConversationID always returns null

ServiceReference.getConversationID always returns null
------------------------------------------------------

                 Key: TUSCANY-1670
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1670
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Java Implementation Extension
    Affects Versions: Java-SCA-0.99
         Environment: WINXP IBMJDK5
            Reporter: Jun JIe Nan
            Priority: Minor
             Fix For: Java-SCA-0.99


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(){
   3.         ServiceReference<CartService> cartRef = hex.getServiceReference(CartService.class,
   4.             "CartComponent/CartService");       
   5.         assertNull(cartRef.getConversation().getConversationID());
   6.         assertNull(cartRef.getConversationID());
   7.         CartService cart = cartRef.getService();
   8.         assertNull(cartRef.getConversation().getConversationID());
   9.         assertNull(cartRef.getConversationID());
  10.         cart.updateItem("Avis", 1);
  11.         assertNotNull(cartRef.getConversation());
  12.         assertNotNull(cartRef.getConversationID()); // conversationID should not be null.
  13.     }

>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(){
        if(cart==null)
            cart = new HashMap<String, Integer>();
    }
   
    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(){
        empty();
    }
}

-- 
Cheers
Jun Jie Nan
  ∧ ∧︵
ミ^ō^ミ灬)~ 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1670) ServiceReference.getConversationID always returns null

Posted by "Jean-Sebastien Delfino (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Sebastien Delfino resolved TUSCANY-1670.
---------------------------------------------

    Resolution: Fixed

I am assuming that this issue has been fixed, instead of leaving it open could you please reopen it if you still see the problem? Thanks.

> ServiceReference.getConversationID always returns null
> ------------------------------------------------------
>
>                 Key: TUSCANY-1670
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1670
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Java Implementation Extension
>    Affects Versions: Java-SCA-0.99
>         Environment: WINXP IBMJDK5
>            Reporter: Jun JIe Nan
>            Priority: Minor
>             Fix For: Java-SCA-1.0
>
>
> 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(){
>    3.         ServiceReference<CartService> cartRef = hex.getServiceReference(CartService.class,
>    4.             "CartComponent/CartService");       
>    5.         assertNull(cartRef.getConversation().getConversationID());
>    6.         assertNull(cartRef.getConversationID());
>    7.         CartService cart = cartRef.getService();
>    8.         assertNull(cartRef.getConversation().getConversationID());
>    9.         assertNull(cartRef.getConversationID());
>   10.         cart.updateItem("Avis", 1);
>   11.         assertNotNull(cartRef.getConversation());
>   12.         assertNotNull(cartRef.getConversationID()); // conversationID should not be null.
>   13.     }
> 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(){
>         if(cart==null)
>             cart = new HashMap<String, Integer>();
>     }
>    
>     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(){
>         empty();
>     }
> }
> -- 
> Cheers
> Jun Jie Nan
>   ∧ ∧︵
> ミ^ō^ミ灬)~ 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1670) ServiceReference.getConversationID always returns null

Posted by "Simon Laws (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525324 ] 

Simon Laws commented on TUSCANY-1670:
-------------------------------------

Probably duplicate of (http://issues.apache.org/jira/browse/TUSCANY-1661). Waiting for JunJei to retest against Trunk.



> ServiceReference.getConversationID always returns null
> ------------------------------------------------------
>
>                 Key: TUSCANY-1670
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1670
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Java Implementation Extension
>    Affects Versions: Java-SCA-0.99
>         Environment: WINXP IBMJDK5
>            Reporter: Jun JIe Nan
>            Priority: Minor
>             Fix For: Java-SCA-0.99
>
>
> 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(){
>    3.         ServiceReference<CartService> cartRef = hex.getServiceReference(CartService.class,
>    4.             "CartComponent/CartService");       
>    5.         assertNull(cartRef.getConversation().getConversationID());
>    6.         assertNull(cartRef.getConversationID());
>    7.         CartService cart = cartRef.getService();
>    8.         assertNull(cartRef.getConversation().getConversationID());
>    9.         assertNull(cartRef.getConversationID());
>   10.         cart.updateItem("Avis", 1);
>   11.         assertNotNull(cartRef.getConversation());
>   12.         assertNotNull(cartRef.getConversationID()); // conversationID should not be null.
>   13.     }
> 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(){
>         if(cart==null)
>             cart = new HashMap<String, Integer>();
>     }
>    
>     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(){
>         empty();
>     }
> }
> -- 
> Cheers
> Jun Jie Nan
>   ∧ ∧︵
> ミ^ō^ミ灬)~ 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org