[ 
https://issues.apache.org/jira/browse/WOOKIE-382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13471094#comment-13471094
 ] 

Scott Wilson commented on WOOKIE-382:
-------------------------------------

:) Well, I had a go at it:


  @Test
  public void sequentialAccess() throws InvalidContentTypeException, 
BadWidgetZipFileException, BadManifestException, Exception{
          HttpClient client = new HttpClient();
          int code;
          PostMethod post;
          W3CWidgetFactory fac;
          W3CWidget widget;
          String url_first_widget;
          String url_second_widget;
          
          // Create first widget instance
          post = new PostMethod(TEST_INSTANCES_SERVICE_URL_VALID);
          post.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
                          + WIDGET_ID_VALID + 
"&userid=FPSeqTest&shareddatakey=test");
          client.executeMethod(post);
          post.releaseConnection();

          // Create flatpack for first widget
          post = new PostMethod(TEST_FLATPACK_SERVICE_URL_VALID);
          post.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
                          + WIDGET_ID_VALID + 
"&userid=FPSeqTest&shareddatakey=test");
          client.executeMethod(post);
          url_first_widget = post.getResponseBodyAsString();
          code = post.getStatusCode();
          assertEquals(200, code);

          // Get flatpack for first widget
          fac = new W3CWidgetFactory();
          fac.setOutputDirectory(temp.getRoot().getPath());
          widget = fac.parse(new URL(url_first_widget),true);
          assertEquals(WIDGET_ID_VALID, widget.getIdentifier());
          
          // Create second widget instance
          post = new PostMethod(TEST_INSTANCES_SERVICE_URL_VALID);
          post.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
                          + TEST_WIDGET_ID_JQM + 
"&userid=FPSeqTest&shareddatakey=test");
          client.executeMethod(post);
          post.releaseConnection();

          // Create flatpack for second widget
          post = new PostMethod(TEST_FLATPACK_SERVICE_URL_VALID);
          post.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
                          + TEST_WIDGET_ID_JQM + 
"&userid=FPSeqTest&shareddatakey=test");
          client.executeMethod(post);
          url_second_widget = post.getResponseBodyAsString();
          code = post.getStatusCode();
          assertEquals(200, code);
          
          // Get flatpack for second widget
          fac = new W3CWidgetFactory();
          fac.setOutputDirectory(temp.getRoot().getPath());
          widget = fac.parse(new URL(url_second_widget),true);
          assertEquals(TEST_WIDGET_ID_JQM, widget.getIdentifier());
          
          // Get instance of first widget
          GetMethod get = new GetMethod(TEST_INSTANCES_SERVICE_URL_VALID);
          get.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
                          + WIDGET_ID_VALID + 
"&userid=FPSeqTest&shareddatakey=test");
          client.executeMethod(get);
          code = get.getStatusCode();
          assertEquals(200,code);
          
          // Get flatpack of first widget
          fac = new W3CWidgetFactory();
          fac.setOutputDirectory(temp.getRoot().getPath());
          widget = fac.parse(new URL(url_first_widget),true);
          assertEquals(WIDGET_ID_VALID, widget.getIdentifier());
  }
  
}

However I can't replicate the problem - is there something you're doing 
differently from the above?
                
> Flatpack function returns wrong widget package
> ----------------------------------------------
>
>                 Key: WOOKIE-382
>                 URL: https://issues.apache.org/jira/browse/WOOKIE-382
>             Project: Wookie
>          Issue Type: Bug
>          Components: Wookie REST API
>            Reporter: Sebastian M
>             Fix For: 0.13.0
>
>
> I'm developing a tool which is getting the list of widgets of Wookie via REST 
> API. When selecting one widget, it creates an instance of the widget (or gets 
> the instance), downloads flatpack of this widget, injects some files, 
> redeploys the widget to wookie and then shows the widget in an iframe (using 
> the instance created/gotten).
> When using 2 or more different Widgets (e.g. Widget A, B and C), the API 
> always returns me the correct instance values and always shows the correct 
> widget in the iframe.
> But the flatpack function has some issues when doing the following steps:
> 1) loading Widget A, it returns the flatpack of Widget A (instance A was just 
> created).
> 2) loading Widget B, it returns the flatpack of Widget B (instance B was just 
> created).
> 3.1) loading Widget A, it will return the flatpack of Widget B (instance B, 
> which was last created).
> 3.2) loading Widget C (any other), it returns the flatpack of Widget C 
> (instance C, which was just created) 
> All in all: when requesting the flatpack of a widget with a newly created 
> instance, I get the correct flatpack. But when requesting another widget 
> where the instance already has been created, it returns the flatpack of the 
> widget with the latest created instance.
> I've tried different parameters when using the flatpack API - just the 
> instance id (the same I use for the iframe output), or all parameters I use 
> for getting/creating the instance. There shareddatakey+userid+api key are 
> always the same and the widget id is always the one of the requested widget.
> I'm using the latest trunk code - checked out and recompiled just some 
> minutes ago.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to