Search in sources :

Example 1 with User

use of org.gluu.oxtrust.model.scim2.User in project camel by apache.

the class UserProducerTest method setUp.

@Before
public void setUp() {
    producer = new UserProducer(endpoint, client);
    when(userService.create(any(User.class))).thenReturn(testOSuser);
    when(userService.get(anyString())).thenReturn(testOSuser);
    List<User> getAllList = new ArrayList<>();
    getAllList.add(testOSuser);
    getAllList.add(testOSuser);
    doReturn(getAllList).when(userService).list();
    dummyUser = createUser();
    when(testOSuser.getName()).thenReturn(dummyUser.getName());
    when(testOSuser.getDescription()).thenReturn(dummyUser.getDescription());
    when(testOSuser.getPassword()).thenReturn(dummyUser.getPassword());
    when(testOSuser.getDomainId()).thenReturn(dummyUser.getDomainId());
    when(testOSuser.getEmail()).thenReturn(dummyUser.getEmail());
}
Also used : User(org.openstack4j.model.identity.v3.User) ArrayList(java.util.ArrayList) UserProducer(org.apache.camel.component.openstack.keystone.producer.UserProducer) Before(org.junit.Before)

Example 2 with User

use of org.gluu.oxtrust.model.scim2.User in project camel by apache.

the class UserProducerTest method updateTest.

@Test
public void updateTest() throws Exception {
    final String id = "myID";
    msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.UPDATE);
    when(testOSuser.getId()).thenReturn(id);
    final String newDescription = "ndesc";
    when(testOSuser.getDescription()).thenReturn(newDescription);
    when(userService.update(any(User.class))).thenReturn(testOSuser);
    msg.setBody(testOSuser);
    producer.process(exchange);
    ArgumentCaptor<User> captor = ArgumentCaptor.forClass(User.class);
    verify(userService).update(captor.capture());
    assertEqualsUser(testOSuser, captor.getValue());
    assertNotNull(captor.getValue().getId());
    assertEquals(newDescription, msg.getBody(User.class).getDescription());
}
Also used : User(org.openstack4j.model.identity.v3.User) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 3 with User

use of org.gluu.oxtrust.model.scim2.User in project camel by apache.

the class UserProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final User in = messageToUser(msg);
    final User out = osV3Client.identity().users().update(in);
    msg.setBody(out);
}
Also used : User(org.openstack4j.model.identity.v3.User) Message(org.apache.camel.Message)

Example 4 with User

use of org.gluu.oxtrust.model.scim2.User in project Douya by DreaminginCodeZH.

the class NavigationAccountListLayout method bind.

public void bind() {
    List<Account> accountList = new ArrayList<>(Arrays.asList(AccountUtils.getAccounts()));
    accountList.remove(AccountUtils.getActiveAccount());
    Account recentOneAccount = AccountUtils.getRecentOneAccount();
    if (recentOneAccount != null) {
        accountList.remove(recentOneAccount);
    }
    Account recentTwoAccount = AccountUtils.getRecentTwoAccount();
    if (recentTwoAccount != null) {
        accountList.remove(recentTwoAccount);
    }
    if (recentOneAccount != null) {
        accountList.add(recentOneAccount);
    }
    if (recentTwoAccount != null) {
        accountList.add(recentTwoAccount);
    }
    int i = 0;
    for (final Account account : accountList) {
        if (i >= mAccountList.getChildCount()) {
            ViewUtils.inflateInto(R.layout.navigation_account_item, mAccountList);
        }
        View accountLayout = mAccountList.getChildAt(i);
        accountLayout.setVisibility(VISIBLE);
        AccountLayoutHolder holder = (AccountLayoutHolder) accountLayout.getTag();
        if (holder == null) {
            holder = new AccountLayoutHolder(accountLayout);
            accountLayout.setTag(holder);
        }
        User user = mAdapter.getUser(account);
        if (user != null) {
            ImageUtils.loadNavigationAccountListAvatar(holder.avatarImage, user.getLargeAvatarOrAvatar());
        } else {
            holder.avatarImage.setImageResource(R.drawable.avatar_icon_grey600_40dp);
        }
        holder.nameText.setText(mAdapter.getPartialUser(account).name);
        accountLayout.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                if (mListener != null) {
                    mListener.switchToAccount(account);
                }
            }
        });
        ++i;
    }
    ViewUtils.setVisibleOrGone(mDividerView, i > 0);
    for (int count = mAccountList.getChildCount(); i < count; ++i) {
        mAccountList.getChildAt(i).setVisibility(GONE);
    }
}
Also used : Account(android.accounts.Account) User(me.zhanghai.android.douya.network.api.info.apiv2.User) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView)

Example 5 with User

use of org.gluu.oxtrust.model.scim2.User in project Douya by DreaminginCodeZH.

the class ProfileActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(0, 0);
    // Calls ensureSubDecor().
    findViewById(android.R.id.content);
    if (savedInstanceState == null) {
        Intent intent = getIntent();
        String userIdOrUid = intent.getStringExtra(EXTRA_USER_ID_OR_UID);
        SimpleUser simpleUser = intent.getParcelableExtra(EXTRA_SIMPLE_USER);
        User user = intent.getParcelableExtra(EXTRA_USER_INFO);
        mProfileFragment = ProfileFragment.newInstance(userIdOrUid, simpleUser, user);
        FragmentUtils.add(mProfileFragment, this, android.R.id.content);
    } else {
        mProfileFragment = FragmentUtils.findById(this, android.R.id.content);
    }
}
Also used : SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) SimpleUser(me.zhanghai.android.douya.network.api.info.apiv2.SimpleUser) User(me.zhanghai.android.douya.network.api.info.apiv2.User) Intent(android.content.Intent)

Aggregations

User (org.gluu.oxtrust.model.scim2.User)18 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)15 ArrayList (java.util.ArrayList)12 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)12 ScimPatchUser (org.gluu.oxtrust.model.scim2.ScimPatchUser)11 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)10 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)10 User (org.openstack4j.model.identity.v3.User)10 DefaultValue (javax.ws.rs.DefaultValue)9 HeaderParam (javax.ws.rs.HeaderParam)9 Produces (javax.ws.rs.Produces)9 URI (java.net.URI)8 Response (javax.ws.rs.core.Response)8 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)8 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)7 IOException (java.io.IOException)7 Date (java.util.Date)7 Map (java.util.Map)7 ListResponse (org.gluu.oxtrust.model.scim2.ListResponse)7 VirtualListViewResponse (org.xdi.ldap.model.VirtualListViewResponse)7