Repository: ambari Updated Branches: refs/heads/trunk d39abe619 -> 3bb4ec107
http://git-wip-us.apache.org/repos/asf/ambari/blob/cc429d48/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java deleted file mode 100644 index 703d877..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.ambari.logsearch.dao; - -import java.util.Collection; - -import org.apache.ambari.logsearch.web.model.Role; -import org.apache.ambari.logsearch.web.model.User; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "/applicationContext.xml" }) -public class UserDaoTest { - - @Autowired - private UserDao dao; - - @Test - public void testUserDaoInitAndFindUser() throws Exception { - User user = dao.loadUserByUsername("testUserName"); - assertEquals(user.getUsername(), "testUserName"); - assertEquals(user.getFirstName(), "Test User Name"); - assertEquals(user.getLastName(), "Test User Name"); - - Collection<? extends GrantedAuthority> authorities = user.getAuthorities(); - assertTrue(authorities.size() == 1); - - Role authority = (Role)authorities.iterator().next(); - assertEquals(authority.getName(), "ROLE_USER"); - assertTrue(authority.getPrivileges().size() == 1); - assertEquals(authority.getPrivileges().get(0).getName(), "READ_PRIVILEGE"); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/cc429d48/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml deleted file mode 100644 index 38437a4..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<beans xmlns="http://www.springframework.org/schema/beans" -xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" -xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" -xmlns:task="http://www.springframework.org/schema/task" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -xmlns:util="http://www.springframework.org/schema/util" -xsi:schemaLocation="http://www.springframework.org/schema/aop -http://www.springframework.org/schema/aop/spring-aop-4.2.xsd -http://www.springframework.org/schema/beans -http://www.springframework.org/schema/beans/spring-beans-4.2.xsd -http://www.springframework.org/schema/context -http://www.springframework.org/schema/context/spring-context-4.2.xsd -http://www.springframework.org/schema/jee -http://www.springframework.org/schema/jee/spring-jee-4.2.xsd -http://www.springframework.org/schema/tx -http://www.springframework.org/schema/tx/spring-tx-4.2.xsd -http://www.springframework.org/schema/task -http://www.springframework.org/schema/task/spring-task-4.2.xsd -http://www.springframework.org/schema/util -http://www.springframework.org/schema/util/spring-util.xsd"> - - <context:component-scan base-package="org.apache.ambari.logsearch" /> - <task:annotation-driven /> - <bean id="xmlPropertyConfigurer" class="org.apache.ambari.logsearch.common.XMLPropertiesHelper" /> - - <bean id="propertyConfigurer" class="org.apache.ambari.logsearch.common.PropertiesHelper"> - <property name="locations"> - <list> - <value>classpath:default.properties</value> - <value>classpath:logsearch.properties</value> - <value>classpath:logsearch-admin-site.xml</value> - </list> - </property> - <property name="propertiesPersister" ref="xmlPropertyConfigurer" /> - </bean> - -</beans>
