com.haulmont.cuba.security.entity.User Java Examples

The following examples show how to use com.haulmont.cuba.security.entity.User. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LookupFieldDsTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnsubscribeSubscribeDsListener() {
    LookupField lookupField = uiComponents.create(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);

    Datasource<User> userDs = getTestUserDatasource();
    Group group = groupsDs.getItems().iterator().next();
    userDs.getItem().setGroup(group);
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setDatasource(null, null);

    // setup
    boolean[] valueWasChanged = {false};
    Datasource.ItemPropertyChangeListener<User> listener = e -> valueWasChanged[0] = true;
    userDs.addItemPropertyChangeListener(listener);

    lookupField.setDatasource(userDs, "group");
    lookupField.setValue(null);
    assertTrue(valueWasChanged[0]);
}
 
Example #2
Source File: LookupPickerFieldDsTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnsubscribeSubscribeDsListener() {
    LookupPickerField component = uiComponents.create(LookupPickerField.NAME);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    component.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    userDs.getItem().setGroup(groups.get(0));

    component.setDatasource(userDs, "group");

    // unbind
    component.setDatasource(null, null);

    // setup
    boolean[] valueWasChanged = {false};
    Datasource.ItemPropertyChangeListener<User> listener = e -> valueWasChanged[0] = true;
    userDs.addItemPropertyChangeListener(listener);
    component.setDatasource(userDs, "group");

    component.setValue(null);
    assertEquals(true, valueWasChanged[0]);
}
 
Example #3
Source File: ExceptionDialog.java    From cuba with Apache License 2.0 6 votes vote down vote up
public void sendSupportEmail(String message, String stackTrace) {
    try {
        User user = userSessionSource.getUserSession().getUser();
        String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());

        Map<String, Object> binding = new HashMap<>();
        binding.put("timestamp", date);
        binding.put("errorMessage", message);
        binding.put("stacktrace", stackTrace);
        binding.put("systemId", clientConfig.getSystemID());
        binding.put("userLogin", user.getLogin());

        if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {
            binding.putAll(additionalExceptionReportBinding);
        }

        reportService.sendExceptionReport(clientConfig.getSupportEmail(), Collections.unmodifiableMap(binding));

        Notification.show(messages.getMainMessage("exceptionDialog.emailSent"));
    } catch (Throwable e) {
        log.error("Error sending exception report", e);
        Notification.show(messages.getMainMessage("exceptionDialog.emailSendingErr"));
    }
}
 
Example #4
Source File: StaticServerSelectorTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
public StaticServerSelectorTest() {
    User user1 = new User();
    user1.setLogin("user1");
    session1 = new UserSession(UUID.randomUUID(), user1, Collections.emptyList(), Locale.ENGLISH, false);

    User user2 = new User();
    user2.setLogin("user2");
    session2 = new UserSession(UUID.randomUUID(), user2, Collections.emptyList(), Locale.ENGLISH, false);

    User user3 = new User();
    user3.setLogin("user3");
    session3 = new UserSession(UUID.randomUUID(), user3, Collections.emptyList(), Locale.ENGLISH, false);

    User user4 = new User();
    user4.setLogin("user4");
    session4 = new UserSession(UUID.randomUUID(), user4, Collections.emptyList(), Locale.ENGLISH, false);
}
 
Example #5
Source File: NonDetachedTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testSaveNotDetached_DM() throws Exception {
    Group companyGroupCopy = metadata.getTools().copy(companyGroup);
    assertTrue(PersistenceHelper.isNew(companyGroupCopy));
    PersistenceHelper.makeDetached(companyGroupCopy);

    User user = persistence.callInTransaction((em) -> em.find(User.class, this.user.getId()));
    User userCopy = metadata.getTools().copy(user);
    assertNull(userCopy.getGroup());

    assertTrue(PersistenceHelper.isNew(userCopy));
    PersistenceHelper.makeDetached(userCopy);

    userCopy.setGroup(companyGroupCopy);
    userCopy.setName("new name");
    AppBeans.get(DataManager.class).commit(userCopy);

    user = persistence.callInTransaction((em) -> em.find(User.class, this.user.getId()));
    assertEquals("new name", user.getName());
}
 
Example #6
Source File: AuthenticationServiceBean.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public UserSession substituteUser(User substitutedUser) {
    try {
        UserSession currentSession = userSessionSource.getUserSession();
        SessionLogEntry logEntry = userSessionLog.updateSessionLogRecord(currentSession, SessionAction.SUBSTITUTION);

        UserSession substitutionSession =
                authenticationManager.substituteUser(substitutedUser);

        Map<String, Object> logParams = emptyMap();
        if (logEntry != null && logEntry.getClientType() != null) {
            logParams = ParamsMap.of(ClientType.class.getName(), logEntry.getClientType().name());
        }

        userSessionLog.createSessionLogRecord(substitutionSession, SessionAction.LOGIN, currentSession, logParams);

        return substitutionSession;
    } catch (Throwable e) {
        log.error("Substitution error", e);
        throw new RuntimeException("Substitution error: " + e.toString());
    }
}
 
Example #7
Source File: SystemAuthenticationProvider.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public AuthenticationDetails authenticate(Credentials credentials) throws LoginException {
    SystemUserCredentials systemLogin = (SystemUserCredentials) credentials;

    String login = systemLogin.getLogin();

    Locale credentialsLocale = systemLogin.getLocale() == null ?
            messages.getTools().getDefaultLocale() : systemLogin.getLocale();

    User user = loadUser(login);
    if (user == null) {
        throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale));
    }

    Locale userLocale = getUserLocale(systemLogin, user);

    UserSession session = userSessionManager.createSession(user, userLocale, true);

    return new SimpleAuthenticationDetails(session);
}
 
Example #8
Source File: LabelDsTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnsubscribeSubscribeDsListener() {
    Label label = uiComponents.create(Label.NAME);

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    user.setName("testName");
    label.setDatasource(userDs, "name");

    label.setDatasource(null, null);
    label.setDatasource(userDs, "name");

    boolean[] valueWasChanged = {false};
    Datasource.ItemPropertyChangeListener<User> propertyChangeListener = e -> valueWasChanged[0] = true;
    userDs.addItemPropertyChangeListener(propertyChangeListener);

    label.setValue("anotherName");
    assertEquals(true, valueWasChanged[0]);
    assertEquals("anotherName", user.getName());
}
 
Example #9
Source File: OptionsGroupTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testDatasource() {
    OptionsGroup component = uiComponents.create(OptionsGroup.class);

    //noinspection unchecked
    Datasource<User> testDs = new DsBuilder()
            .setId("testDs")
            .setJavaClass(User.class)
            .setView(viewRepository.getView(User.class, View.LOCAL))
            .buildDatasource();

    testDs.setItem(new User());
    ((DatasourceImpl) testDs).valid();

    assertNull(component.getValue());

    component.setDatasource(testDs, "group");
    assertNotNull(component.getDatasource());
}
 
Example #10
Source File: AuthenticationManagerBean.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected User loadSubstitutedUser(User substitutedUser, UserSession currentSession, EntityManager em) {
    TypedQuery<User> query = em.createQuery(
            "select su from sec$User su where " +
                    "su in (select s.substitutedUser from sec$User u join u.substitutions s " +
                    "where u.id = ?1 and s.substitutedUser.id = ?2)",
            User.class
    );
    query.setParameter(1, currentSession.getUser().getId());
    query.setParameter(2, substitutedUser.getId());
    List<User> list = query.getResultList();
    if (list.isEmpty()) {
        throw new NoResultException("User not found");
    }

    return list.get(0);
}
 
Example #11
Source File: ViewRepositoryTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultViews() {
    View localView = repository.getView(User.class, View.LOCAL);
    assertNotNull(localView);
    assertNotNull(localView.getProperty("name"));
    assertNotNull(localView.getProperty("login"));
    assertNotNull(localView.getProperty("email"));
    assertNull(localView.getProperty("userRoles"));

    View minView = repository.getView(User.class, View.MINIMAL);
    assertNotNull(minView);
    assertNotNull(minView.getProperty("name"));
    assertNotNull(minView.getProperty("login"));
    assertNull(minView.getProperty("email"));
    assertNull(minView.getProperty("userRoles"));

    View baseView = repository.getView(User.class, View.BASE);
    assertNotNull(baseView.getProperty("name"));
    assertNotNull(baseView.getProperty("login"));
    assertNotNull(localView.getProperty("email"));

    Collection<String> definedViews = repository.getViewNames(User.class);
    assertFalse(definedViews.contains(View.LOCAL));
    assertFalse(definedViews.contains(View.MINIMAL));
    assertFalse(definedViews.contains(View.BASE));
}
 
Example #12
Source File: DatePickerDsTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnsubscribeDsListener() {
    DatePicker datePicker = uiComponents.create(DatePicker.NAME);

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    Date updateTs = new Date();
    user.setUpdateTs(updateTs);
    datePicker.setDatasource(userDs, "updateTs");

    // unbind
    datePicker.setDatasource(null, null);

    Datasource.ItemPropertyChangeListener<User> propertyChangeListener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    userDs.addItemPropertyChangeListener(propertyChangeListener);

    datePicker.setValue(new Date());
    assertEquals(updateTs, user.getUpdateTs());
}
 
Example #13
Source File: ViewRepositoryTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetView() {
    View view = repository.getView(User.class, "test");
    assertNotNull(view);
    assertNotNull(view.getProperty("name"));
    assertNotNull(view.getProperty("login"));
    assertNotNull(view.getProperty("userRoles"));

    View userRolesView = view.getProperty("userRoles").getView();
    assertNotNull(userRolesView);
    assertNotNull(userRolesView.getProperty("role"));

    View roleView = userRolesView.getProperty("role").getView();
    assertNotNull(roleView);
    assertNotNull(roleView.getProperty("name"));
}
 
Example #14
Source File: SimpleWeeklyTimesheets.java    From sample-timesheets with Apache License 2.0 6 votes vote down vote up
@Install(to = "weeklyTsTable", subject = "styleProvider")
private String weeklyTsTableStyleProvider(WeeklyReportEntry entity, String property) {
    String id = null;
    if (property != null && property.endsWith(COLUMN_SUFFIX)) {
        id = property.replace(COLUMN_SUFFIX, "");
    }

    DayOfWeek day = DayOfWeek.fromId(id != null ? id : property);
    if (entity == null) {
        User currentOrSubstitutedUser = userSession.getCurrentOrSubstitutedUser();
        if (day != null) {
            return validationTools.isWorkTimeMatchToPlanForDay(
                    DateTimeUtils.getSpecificDayOfWeek(firstDayOfWeek, day.getJavaCalendarDay()),
                    currentOrSubstitutedUser) ? null : "overtime";
        } else if (TOTAL_COLUMN_ID.equals(property)) {
            return validationTools.isWorkTimeMatchToPlanForWeek(
                    firstDayOfWeek, currentOrSubstitutedUser) ? null : "overtime";
        }
    }
    return null;
}
 
Example #15
Source File: DynamicAttributesTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testCollectionOfEnumAttribute() {
    LoadContext<User> loadContext = LoadContext.create(User.class).setId(user.getId()).setLoadDynamicAttributes(true);
    User loadedUser = dataManager.load(loadContext);
    List<String> enumValues = loadedUser.getValue("+userEnumCollectionAttribute");
    assertEquals(2, enumValues.size());
    assertTrue(enumValues.contains("option1"));
    assertFalse(enumValues.contains("option2"));

    loadedUser.setValue("+userEnumCollectionAttribute", Lists.newArrayList("option2"));
    dataManager.commit(loadedUser);

    loadedUser = dataManager.load(loadContext);
    enumValues = loadedUser.getValue("+userEnumCollectionAttribute");
    assertEquals(1, enumValues.size());
    assertEquals("option2", enumValues.get(0));
}
 
Example #16
Source File: BeforeCommitTransactionListenerTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testChangeEntity() throws Exception {
    User u1 = metadata.create(User.class);
    u1.setLogin("TxLstnrTst-1-" + u1.getId());
    u1.setGroup(companyGroup);

    TestBeforeCommitTxListener.test = "testChangeEntity";
    try (Transaction tx = persistence.createTransaction()) {
        persistence.getEntityManager().persist(u1);
        tx.commit();
    } finally {
        TestBeforeCommitTxListener.test = null;
    }

    try (Transaction tx = persistence.createTransaction()) {
        User user = persistence.getEntityManager().find(User.class, u1.getId());
        assertEquals("set by tx listener", user.getName());
    }
}
 
Example #17
Source File: ProjectsServiceBean.java    From sample-timesheets with Apache License 2.0 6 votes vote down vote up
@Override
public List<TimeEntry> getApprovableTimeEntriesForPeriod(
        Date start, Date end, User approver, User user, @Nullable TimeEntryStatus status, @Nullable String viewName
) {
    LoadContext<TimeEntry> loadContext = new LoadContext<>(TimeEntry.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    String queryStr = "select e from ts$TimeEntry e join e.task t join t.project pr join pr.participants p " +
            "where p.user.id = :approverId and (p.role.code = '" + MANAGER.getId() + "' or p.role.code = '" + APPROVER.getId() + "') " +
            "and e.user.id = :userId and (e.date between :start and :end)";
    if (status != null) {
        queryStr += " and e.status = :status";
    }
    LoadContext.Query query = loadContext.setQueryString(queryStr)
            .setParameter("start", start)
            .setParameter("end", end)
            .setParameter("approverId", approver.getId())
            .setParameter("userId", user.getId());
    if (status != null) {
        query.setParameter("status", status);
    }
    return dataManager.loadList(loadContext);
}
 
Example #18
Source File: QueryConditionsUsageTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void test() {
    LogicalCondition condition = and()
            .add(where("u.login like :login"))
            .add(where("u.userRoles ur", "ur.role.name = :roleName"))
            .add(or()
                    .add(where("u.foo = :foo"))
                    .add(where("u.bar = :bar"))
            );

    LoadContext.Query query = LoadContext.createQuery("select u from sec$User u")
            .setCondition(condition)
            .setParameter("login", "admin");
    LoadContext<User> loadContext = LoadContext.create(User.class).setQuery(query);
    List<User> users = dataManager.loadList(loadContext);
    assertEquals(1, users.size());

    Optional<User> userOpt = dataManager.load(User.class)
            .query("select u from sec$User u")
            .condition(condition)
            .parameter("login", "admin")
            .optional();
    assertTrue(userOpt.isPresent());
}
 
Example #19
Source File: TestCascadingEntityListener.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void onBeforeUpdate(User entity, EntityManager entityManager) {
    events.add("onBeforeUpdate: " + entity.getId());

    Transaction.Runnable code = (em) -> {
        TypedQuery<User> query = entityManager.createQuery("select u from sec$User u where u.login = 'admin'", User.class);
        if (withView) {
            query.setViewName(View.MINIMAL);
        }
        User admin = query.getSingleResult();
        System.out.println(admin.getLogin());
    };

    if (withNewTx) {
        AppBeans.get(Persistence.class).runInTransaction(code);
    } else {
        code.run(entityManager);
    }
}
 
Example #20
Source File: CheckBoxDsTest.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Test
public void testUnsubscribeComponentListener() {
    CheckBox checkBox = uiComponents.create(CheckBox.NAME);

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    user.setActive(true);
    checkBox.setDatasource(userDs, "active");

    // unbind
    checkBox.setDatasource(null, null);

    Consumer valueChangeListener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    checkBox.addValueChangeListener(valueChangeListener);

    user.setActive(false);
    assertEquals(true, checkBox.getValue());
}
 
Example #21
Source File: ProjectsServiceBean.java    From sample-timesheets with Apache License 2.0 5 votes vote down vote up
@Override
public List<User> getProjectUsers(Project project, @Nullable String viewName) {
    LoadContext<User> loadContext = new LoadContext<>(User.class);
    if (viewName != null) {
        loadContext.setView(viewName);
    }
    loadContext.setQueryString("select u from sec$User u, ts$ProjectParticipant pp " +
            "where pp.project.id = :projectId and pp.user.id = u.id")
            .setParameter("projectId", project.getId());
    return dataManager.loadList(loadContext);
}
 
Example #22
Source File: DataManagerDistinctResultsTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
private LinkedHashSet<User> load(int firstResult, int maxResults, String queryString) {
    DataManager ds = AppBeans.get(DataManager.NAME);
    LoadContext<User> lc = new LoadContext<>(User.class);
    LoadContext.Query q = lc.setQueryString(queryString);
    q.setParameter("groupId", groupId);
    q.setFirstResult(firstResult);
    q.setMaxResults(maxResults);
    List<User> list = ds.loadList(lc);
    return new LinkedHashSet<>(list);
}
 
Example #23
Source File: LoginPasswordAuthenticationProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public AuthenticationDetails authenticate(Credentials credentials) throws LoginException {
    LoginPasswordCredentials loginAndPassword = (LoginPasswordCredentials) credentials;

    String login = loginAndPassword.getLogin();
    Map<String, Object> params = loginAndPassword.getParams();

    Locale credentialsLocale = loginAndPassword.getLocale() == null ?
            messages.getTools().getDefaultLocale() : loginAndPassword.getLocale();

    if (Strings.isNullOrEmpty(login)) {
        // empty login is not valid
        throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale));
    }

    checkUserCredentials(credentials);

    User user = loadUser(login, params);
    if (user == null) {
        throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale));
    }

    if (!passwordEncryption.checkPassword(user, loginAndPassword.getPassword())) {
        throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale));
    }

    Locale userLocale = getUserLocale(loginAndPassword, user);

    UserSession session = createSession(loginAndPassword, user, userLocale);

    setClientSessionParams(loginAndPassword, session);

    AuthenticationDetails authenticationDetails = new SimpleAuthenticationDetails(session);

    checkUserAccess(loginAndPassword, authenticationDetails);

    return authenticationDetails;
}
 
Example #24
Source File: LoginTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
private User loadUser(final UUID userId) {
    return cont.persistence().createTransaction().execute(new Transaction.Callable<User>() {
        @Override
        public User call(EntityManager em) {
            return em.find(User.class, userId);
        }
    });
}
 
Example #25
Source File: LookupPickerFieldDsTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Test
public void testValueChangeListener() {
    LookupPickerField component = uiComponents.create(LookupPickerField.NAME);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    component.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    user.setGroup(groups.get(0));

    // listener before datasource

    boolean[] valueWasChanged = {false};
    Consumer<HasValue.ValueChangeEvent> listener = e -> valueWasChanged[0] = true;
    component.addValueChangeListener(listener);

    component.setDatasource(userDs, "group");
    assertEquals(true, valueWasChanged[0]);

    // reset state
    valueWasChanged[0] = false;
    component.removeValueChangeListener(listener);
    component.setDatasource(null, null);

    // datasource before listener

    component.setDatasource(userDs, "group");
    component.addValueChangeListener(listener);
    user.setGroup(null);
    assertEquals(true, valueWasChanged[0]);
}
 
Example #26
Source File: EntityManagerTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindSeparateViews() throws Exception {

    View view1 = new View(User.class, false)
            .addProperty("name")
            .addProperty("login");

    View view2 = new View(User.class, false)
            .addProperty("name")
            .addProperty("login")
            .addProperty("group", new View(Group.class)
                    .addProperty("name"));

    User user1, user2;

    try (Transaction tx = cont.persistence().createTransaction()) {
        EntityManager em = cont.persistence().getEntityManager();
        user1 = em.find(User.class, userId, view1);
        user2 = em.find(User.class, user2Id, view2);

        tx.commit();
    }
    user1 = reserialize(user1);
    user2 = reserialize(user2);

    assertNotNull(user1);
    assertNotNull(user1.getCreatedBy());
    try {
        user1.getGroup();
        fail();
    } catch (Exception ignored) {
    }

    assertNotNull(user2);
    assertNotNull(user2.getCreatedBy());
    assertNotNull(user2.getGroup());
}
 
Example #27
Source File: GetReferenceIdTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
    try (Transaction tx = cont.persistence().createTransaction()) {
        user = cont.metadata().create(User.class);
        user.setName("test user");
        user.setLogin("test login");
        user.setGroup(cont.entityManager().find(Group.class, TestSupport.COMPANY_GROUP_ID));
        cont.entityManager().persist(user);

        tx.commit();
    }
}
 
Example #28
Source File: UserSessions.java    From cuba with Apache License 2.0 5 votes vote down vote up
public UserSessions() {
    User noUser = new User();
    noUser.setLogin("server");
    NO_USER_SESSION = new UserSession(
            UUID.fromString("a66abe96-3b9d-11e2-9db2-3860770d7eaf"), noUser,
            Collections.emptyList(), Locale.ENGLISH, true) {
        @Override
        public UUID getId() {
            return AppContext.NO_USER_CONTEXT.getSessionId();
        }
    };
}
 
Example #29
Source File: DataManagerTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Test
public void testTemporalType() throws Exception {
    Date nextYear = DateUtils.addYears(AppBeans.get(TimeSource.class).currentTimestamp(), 1);
    LoadContext<User> loadContext = LoadContext.create(User.class).setQuery(
            LoadContext.createQuery("select u from sec$User u where u.createTs = :ts")
                    .setParameter("ts", nextYear, TemporalType.DATE));

    List<User> users = dataManager.loadList(loadContext);
    assertTrue(users.isEmpty());
}
 
Example #30
Source File: ViewRepositoryTest.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Test
public void testInheritance() {
    View view = repository.getView(User.class, "testInheritance");
    assertNotNull(view);
    assertNotNull(view.getProperty("name"));
    assertNotNull(view.getProperty("login"));
    assertNotNull(view.getProperty("userRoles"));
    assertNull(view.getProperty("substitutions"));
}