Examples of User


Examples of org.apache.wink.itest.contextresolver.User

    }

    public void testUserContextProvider() throws Exception {
        HttpClient httpClient = new HttpClient();

        User user = new User();
        user.setUserName("joedoe@example.com");
        JAXBElement<User> element =
            new JAXBElement<User>(new QName("http://jaxb.context.tests", "user"), User.class, user);
        JAXBContext context = JAXBContext.newInstance(ObjectFactory.class);
        StringWriter sw = new StringWriter();
        Marshaller m = context.createMarshaller();
        m.marshal(element, sw);
        PostMethod postMethod = new PostMethod(getBaseURI());
        try {
            postMethod.setRequestEntity(new ByteArrayRequestEntity(sw.toString().getBytes(),
                                                                   "text/xml"));
            httpClient.executeMethod(postMethod);
            assertEquals(204, postMethod.getStatusCode());
        } finally {
            postMethod.releaseConnection();
        }

        GetMethod getMethod = new GetMethod(getBaseURI() + "/joedoe@example.com");
        try {
            httpClient.executeMethod(getMethod);
            assertEquals(200, getMethod.getStatusCode());
            Unmarshaller u = context.createUnmarshaller();
            element =
                u.unmarshal(new StreamSource(getMethod.getResponseBodyAsStream()), User.class);
            assertNotNull(element);
            user = element.getValue();
            assertNotNull(user);
            assertEquals("joedoe@example.com", user.getUserName());
        } finally {
            getMethod.releaseConnection();
        }
    }
View Full Code Here

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

  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);
    assertTrue("Wrong number of users returned",users.length>1);
    assertTrue("Wrong user returned", users[0].getLoginName().equals("testuser"));
    assertTrue("Wrong user returned", users[1].getLoginName().equals("test1"));
View Full Code Here

Examples of org.apache.wsrp4j.consumer.User

            return;
        }

        // get the wsrp user and store it as an attribute on the instance
        final String currentUserID = this.service.getComponentManager().getProfileManager().getUser().getUserName();      
        User user = this.consumerEnvironment.getUserRegistry().getUser(currentUserID);
        if ( user == null ) {
            // create a new user
            user = new UserImpl(currentUserID);
            user.setUserContext(this.userContextProvider.createUserContext(currentUserID));
            this.consumerEnvironment.getUserRegistry().addUser(user);
        }
        coplet.setTemporaryAttribute(ATTRIBUTE_NAME_USER, user);

        // get the portlet handle
View Full Code Here

Examples of org.apdplat.module.security.model.User

     * 删除角色前,把该角色从所有引用该角色的用户中移除
     * @param ids
     */
    @Override
    public void prepareForDelete(Integer[] ids){
        User loginUser=UserHolder.getCurrentLoginUser();
        for(int id :ids){
            Role role=getService().retrieve(Role.class, id);           
            boolean canDel=true;
            //获取拥有等待删除的角色的所有用户
            List<User> users=role.getUsers();
            for(User user : users){               
                if(PropertyHolder.getBooleanProperty("demo")){
                    if(user.getUsername().equals("admin")){
                        throw new RuntimeException("演示版本不能删除admin用户拥有的角色");
                    }
                }
                if(loginUser.getId()==user.getId()){
                    canDel=false;
                }
            }
            if(!canDel) {
                continue;
View Full Code Here

Examples of org.appfuse.model.User

 
    @Autowired
    private UserManager userManager;

    public User create(Class<? extends User> clazz) {
        return new User();
    }
View Full Code Here

Examples of org.archfirst.bfoms.domain.security.User

        LoggerFactory.getLogger(BrokerageAccountService.class);

    // ----- Commands -----
    public Long openNewAccount(String username, String accountName) {

        User user = getUser(username);
        BrokerageAccount account =
            brokerageAccountFactory.createIndividualAccountWithFullAccess(
                accountName,
                user.getPerson(),
                user);
        return account.getId();
    }
View Full Code Here

Examples of org.arquillian.example.model.User

  public String register() {
    String username = credentials.getUsername();
    String password = credentials.getPassword();

    User user;

    if (username != null && password != null) {
      user = new User();
      user.setUsername(username);
      user.setPassword(password);
      if (authentizator.register(user)) {
        return "login.xhtml";
      } else {
        return "register.xhtml";
      }
View Full Code Here

Examples of org.atomojo.app.auth.User

      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      dest.send(constructor.createDocument());
      dest.send(constructor.createElement(NM_USERS));
      dest.send(constructor.createCharacters("\n"));
      while (users.hasNext()) {
         User user = users.next();
         UserResource.toXML(user,new RemoveDocumentFilter(dest));
         dest.send(constructor.createCharacters("\n"));
      }
      dest.send(constructor.createElementEnd(NM_USERS));
      dest.send(constructor.createDocumentEnd());
View Full Code Here

Examples of org.atomojo.auth.service.db.User

            if (facet!=null) {
               if (facet.equals(USER_FACET)) {
                  if (facetId!=null) {
                     try {
                        UUID id = UUID.fromString(facetId);
                        User user = db.getUser(id);
                        if (user!=null) {
                           Representation entity = new DBObjectRepresentation(MediaType.APPLICATION_XML,user);
                           entity.setCharacterSet(CharacterSet.UTF_8);
                           return entity;
                        } else {
                           getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND);
                           return new StringRepresentation("Canot find user by id "+facetId);
                        }
                     } catch (SQLException ex) {
                        getContext().getLogger().log(Level.SEVERE,"Cannot get user with id "+facetId+" from database.",ex);
                        getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
                        return new StringRepresentation("Exception while processing, see logs.");
                     } catch (IllegalArgumentException ex) {
                        getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
                        return new StringRepresentation("Bad UUID value "+facetId);
                     }
                  } else if (facetName!=null) {
                     try {
                        User user = db.getUser(facetName);
                        if (user!=null) {
                           Representation entity = new DBObjectRepresentation(MediaType.APPLICATION_XML,user);
                           entity.setCharacterSet(CharacterSet.UTF_8);
                           return entity;
                        } else {
View Full Code Here

Examples of org.baeldung.jackson.dtos.User

        final JsonNode node = jp.getCodec().readTree(jp);
        final int id = (Integer) ((IntNode) node.get("id")).numberValue();
        final String itemName = node.get("itemName").asText();
        final int userId = (Integer) ((IntNode) node.get("owner")).numberValue();

        return new ItemWithSerializer(id, itemName, new User(userId, null));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.