Search in sources :

Example 36 with User

use of sqlite.kripton209.model1.User in project Douya by DreaminginCodeZH.

the class UserResource method get.

@Override
public User get() {
    User user = super.get();
    if (user == null) {
        // Can be called before onCreate() is called.
        ensureArguments();
        user = mExtraUser;
    }
    return user;
}
Also used : User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)

Example 37 with User

use of sqlite.kripton209.model1.User in project openstack4j by ContainX.

the class KeystoneUserServiceTests method crud_User_Test.

/**
     * CRUD user tests
     *
     * @throws Exception
     */
public void crud_User_Test() throws Exception {
    // --create
    respondWith(JSON_USER_CREATE);
    User newUser = osv3().identity().users().create(USER_DOMAIN_ID, "foobar", "secret", "foobar@example.org", true);
    assertEquals(newUser.getName(), "foobar");
    assertEquals(newUser.getDomainId(), USER_DOMAIN_ID);
    assertEquals(newUser.getEmail(), "foobar@example.org");
    assertEquals(newUser.isEnabled(), true);
    assertNotNull(newUser.getId());
    // --read
    respondWith(JSON_USER_READ);
    User user = osv3().identity().users().getByName("foobar", USER_DOMAIN_ID);
    assertEquals(user.getId(), newUser.getId());
    assertEquals(user.getName(), "foobar");
    assertEquals(user.getEmail(), "foobar@example.org");
    assertEquals(user.isEnabled(), true);
    assertEquals(user.getDomainId(), USER_DOMAIN_ID);
    String crudUserId = user.getId();
    // --update
    respondWith(JSON_USER_UPDATE);
    User updatedUser = osv3().identity().users().update(KeystoneUser.builder().id(crudUserId).email("updatedFoobar@example.org").enabled(true).build());
    assertEquals(updatedUser.getEmail(), "updatedFoobar@example.org");
    assertEquals(updatedUser.getName(), "foobar");
    assertEquals(updatedUser.isEnabled(), true);
    assertEquals(updatedUser.getId(), crudUserId);
    assertEquals(updatedUser.getDomainId(), USER_DOMAIN_ID);
    // --delete
    respondWith(204);
    ActionResponse response_delete = osv3().identity().users().delete(crudUserId);
    assertTrue(response_delete.isSuccess());
}
Also used : KeystoneUser(org.openstack4j.openstack.identity.v3.domain.KeystoneUser) User(org.openstack4j.model.identity.v3.User) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 38 with User

use of sqlite.kripton209.model1.User in project openstack4j by ContainX.

the class KeystoneUserServiceTests method getUser_byId_Test.

/**
     * get speciific user by user identifier
     *
     * @throws Exception
     */
public void getUser_byId_Test() throws Exception {
    respondWith(JSON_USER_GET_BYID);
    User user = osv3().identity().users().get(USER_ID);
    assertEquals(user.getId(), USER_ID);
    assertEquals(user.getName(), USER_NAME);
    assertEquals(user.getDomainId(), USER_DOMAIN_ID);
}
Also used : KeystoneUser(org.openstack4j.openstack.identity.v3.domain.KeystoneUser) User(org.openstack4j.model.identity.v3.User)

Example 39 with User

use of sqlite.kripton209.model1.User in project openstack4j by ContainX.

the class KeystoneUserServiceTests method getUser_byName_byDomainId_Test.

/**
     * returns the user specified by name and domain.
     *
     * @throws Exception
     */
public void getUser_byName_byDomainId_Test() throws Exception {
    respondWith(JSON_USER_GET_BYNAME_BYDOMAINID);
    User user = osv3().identity().users().getByName(USER_NAME, USER_DOMAIN_ID);
    assertEquals(user.getName(), USER_NAME);
    assertEquals(user.getId(), USER_ID);
    assertEquals(user.getDomainId(), USER_DOMAIN_ID);
}
Also used : KeystoneUser(org.openstack4j.openstack.identity.v3.domain.KeystoneUser) User(org.openstack4j.model.identity.v3.User)

Example 40 with User

use of sqlite.kripton209.model1.User in project camel by apache.

the class UserProducer method messageToUser.

private User messageToUser(Message message) {
    User project = message.getBody(User.class);
    if (project == null) {
        Map headers = message.getHeaders();
        UserBuilder builder = Builders.user();
        ObjectHelper.notEmpty(message.getHeader(OpenstackConstants.NAME, String.class), "Name");
        builder.name(message.getHeader(OpenstackConstants.NAME, String.class));
        if (headers.containsKey(KeystoneConstants.DOMAIN_ID)) {
            builder.domainId(message.getHeader(KeystoneConstants.DOMAIN_ID, String.class));
        }
        if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
            builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
        }
        if (headers.containsKey(KeystoneConstants.PASSWORD)) {
            builder.password(message.getHeader(KeystoneConstants.PASSWORD, String.class));
        }
        if (headers.containsKey(KeystoneConstants.EMAIL)) {
            builder.email(message.getHeader(KeystoneConstants.EMAIL, String.class));
        }
        project = builder.build();
    }
    return project;
}
Also used : User(org.openstack4j.model.identity.v3.User) Map(java.util.Map) UserBuilder(org.openstack4j.model.identity.v3.builder.UserBuilder)

Aggregations

User (pl.plajer.villagedefense3.User)30 Player (org.bukkit.entity.Player)18 User (org.gluu.oxtrust.model.scim2.User)17 EventHandler (org.bukkit.event.EventHandler)11 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)10 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)10 User (org.openstack4j.model.identity.v3.User)10 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)8 Arena (pl.plajer.villagedefense3.arena.Arena)8 ArrayList (java.util.ArrayList)7 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)7 Date (java.util.Date)6 SimpleUser (me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser)6 User (me.zhanghai.android.douya.network.api.info.apiv2.User)6 ItemStack (org.bukkit.inventory.ItemStack)5 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)5 Test (org.junit.Test)5 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)4 BigDecimal (java.math.BigDecimal)4 URI (java.net.URI)4