Package org.apache.wookie.connector.framework

Examples of org.apache.wookie.connector.framework.WidgetInstance


       try {
            connectorService = getWookieConnectorService(wookieServerUrl, wookieApiKey, sharedDataKey);
            org.apache.wookie.connector.framework.User user = new org.apache.wookie.connector.framework.User(String.valueOf(viewer.getUsername()), viewer.getUsername());
            connectorService.setCurrentUser(user);
            logger.debug("Getting widget:"+widget.getUrl()+" from:" +connectorService.getConnection().getURL());
            WidgetInstance instance = connectorService.getOrCreateInstance(widget.getUrl());
            return createWidget(instance);
        } catch (WookieConnectorException e) {
            logger.error("Unable to connect to Wookie server", e);
            // FIXME: provide a real error widget
            return createWidget(new WidgetInstance("error", "error", e.getMessage(), "100", "100"));
        } catch (IOException e) {
            logger.error("Problem communicating with Wookie server", e);
            // FIXME: provide a real error widget
            return createWidget(new WidgetInstance("error", "error", e.getMessage(), "100", "100"));
        }
    }
View Full Code Here


    assertEquals("383", uploadedWidget.getHeight());
  }
 
  @Test
  public void localization() throws IOException, WookieConnectorException{   
    WidgetInstance instance;
  
    service.getCurrentUser().setLocale("fr");
    instance = service.getOrCreateInstance("http://www.getwookie.org/widgets/localetest");
    assertEquals("Widget instance has wrong locale", "tester les paramètres régionaux", instance.getTitle());
    assertTrue("Widget instance has incorrect locale URL", instance.getUrl().contains("locales/fr"));
   
    assertEquals("255", instance.getWidth());
    assertEquals("383", instance.getHeight());
   
    service.getCurrentUser().setLocale("en");
    instance = service.getOrCreateInstance("http://www.getwookie.org/widgets/localetest");
    assertEquals("Widget instance has wrong locale", "locale test", instance.getTitle());
    assertTrue("Widget instance has incorrect locale URL", instance.getUrl().contains("locales/en"))
  }
View Full Code Here

  }
 
  @Test
  public void getOrCreateInstance() throws WookieConnectorException, IOException {
    HashMap<String, Widget> widgets = service.getAvailableWidgets();
    WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);
  }
View Full Code Here

 
  @Test
  public void getOrCreateLocalizedInstance() throws WookieConnectorException, IOException {
  service.getCurrentUser().setLocale("fr");
    HashMap<String, Widget> widgets = service.getAvailableWidgets();
    WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);
  }
View Full Code Here

  }
 
  @Test
  public void addParticipant() throws WookieConnectorException, IOException {
  HashMap<String, Widget> widgets = service.getAvailableWidgets();
  WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);
   
  User user = new User("test1","test user 1");
    service.addParticipant(instance, user);
    User[] users = service.getUsers(instance);
View Full Code Here

  }
 
  @Test
  public void addParticipantWithThumbnailUrl() throws WookieConnectorException, IOException{
    HashMap<String, Widget> widgets = service.getAvailableWidgets();
    WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);   
    User user = new User("thumbnailtestuser","thumbnail test user","http://bar.com/icon.png");
    service.addParticipant(instance, user);
    User[] users = service.getUsers(instance);
    user = users[users.length-1];
View Full Code Here

  }
 
  @Test
  public void addParticipantWithRole() throws WookieConnectorException, IOException{
    HashMap<String, Widget> widgets = service.getAvailableWidgets();
    WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);   
    User user = new User("roletestuser","role test user","http://bar.com/icon.png","OWNER");
    service.addParticipant(instance, user);
    User[] users = service.getUsers(instance);
    user = users[users.length-1];
View Full Code Here

  }
 
  @Test
  public void properties() throws WookieConnectorException, IOException{
      HashMap<String, Widget> widgets = service.getAvailableWidgets();
      WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
      assertNotNull("Retrieved widget instance is null", instance);
      service.setPropertyForInstance(instance, true, "test_property2", "test data");
      String data = service.getPropertyForInstance(instance, "test_property2");
      assertNotNull ( "Data from property is null", data );
      service.updatePropertyForInstance(instance, true, "test_property2", "new test data");
View Full Code Here

            connectorService = getWookieConnectorService(wookieServerUrl, wookieApiKey, sharedDataKey);
            org.apache.wookie.connector.framework.User user = new org.apache.wookie.connector.framework.User(String.valueOf(viewer.getUsername()), viewer.getUsername());
            connectorService.setCurrentUser(user);
           
            logger.debug("Getting widget:"+widget.getUrl()+" from:" +connectorService.getConnection().getURL());
            WidgetInstance instance = connectorService.getOrCreateInstance(widget.getUrl());
            return createWidget(instance);
        } catch (WookieConnectorException e) {
            logger.error("Unable to connect to Wookie server", e);
            // FIXME: provide a real error widget
            return createWidget(new WidgetInstance("error", "error", e.getMessage(), "100", "100"));
        } catch (IOException e) {
            logger.error("Problem communicating with Wookie server", e);
            // FIXME: provide a real error widget
            return createWidget(new WidgetInstance("error", "error", e.getMessage(), "100", "100"));
        }
    }
View Full Code Here

  }
 
  @Test
  public void getOrCreateInstance() throws WookieConnectorException, IOException {
    HashMap<String, Widget> widgets = service.getAvailableWidgets();
    WidgetInstance instance = service.getOrCreateInstance((Widget)widgets.values().toArray()[0]);
    assertNotNull("Retrieved widget instance is null", instance);
  }
View Full Code Here

TOP

Related Classes of org.apache.wookie.connector.framework.WidgetInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.