Search in sources :

Example 26 with User

use of com.rebuild.core.privileges.bizz.User in project rebuild by getrebuild.

the class DistributedSupportTest method testMap.

@Test
void testMap() {
    DistributedSupport distributedSupport = (DistributedSupport) Application.getContext().getBean("DistributedSupport");
    ConcurrentMap<String, User> users = distributedSupport.getMap("RB_USER");
    users.put("User1", Application.getUserStore().getUser(UserService.SYSTEM_USER));
    User fromCache = users.get("User1");
    Assertions.assertEquals(fromCache, Application.getUserStore().getUser(UserService.SYSTEM_USER));
    Assertions.assertTrue(users.containsKey("User1"));
    Assertions.assertFalse(users.containsKey("User2"));
    Assertions.assertEquals(1, users.size());
    users.remove("User1");
    Assertions.assertTrue(users.isEmpty());
}
Also used : User(com.rebuild.core.privileges.bizz.User) Test(org.junit.jupiter.api.Test)

Aggregations

User (com.rebuild.core.privileges.bizz.User)26 ID (cn.devezhao.persist4j.engine.ID)13 JSONObject (com.alibaba.fastjson.JSONObject)8 GetMapping (org.springframework.web.bind.annotation.GetMapping)6 Member (cn.devezhao.bizz.security.member.Member)3 JSONArray (com.alibaba.fastjson.JSONArray)3 Entity (cn.devezhao.persist4j.Entity)2 Record (cn.devezhao.persist4j.Record)2 JSON (com.alibaba.fastjson.JSON)2 UserService (com.rebuild.core.privileges.UserService)2 Department (com.rebuild.core.privileges.bizz.Department)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Test (org.junit.jupiter.api.Test)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 Team (cn.devezhao.bizz.security.member.Team)1 Field (cn.devezhao.persist4j.Field)1 ApiInvokeException (com.rebuild.api.ApiInvokeException)1