http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java deleted file mode 100644 index c6a5ba5..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java +++ /dev/null @@ -1,205 +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.web.security; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchAuthenticationProviderTest { - private static final Authentication SUCCESSFUL_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials"); - private static final Authentication FAILED_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials"); - static { - SUCCESSFUL_AUTHENTICATION.setAuthenticated(true); - FAILED_AUTHENTICATION.setAuthenticated(false); - } - - private LogsearchAuthenticationProvider provider; - - private LogsearchLdapAuthenticationProvider mockLdapProvider; - private LogsearchFileAuthenticationProvider mockFileProvider; - private LogsearchExternalServerAuthenticationProvider mockExternalServerProvider; - private LogsearchSimpleAuthenticationProvider mockSimpleProvider; - - @Before - public void resetContext() throws Exception { - provider = new LogsearchAuthenticationProvider(); - - mockLdapProvider = strictMock(LogsearchLdapAuthenticationProvider.class); - mockFileProvider = strictMock(LogsearchFileAuthenticationProvider.class); - mockExternalServerProvider = strictMock(LogsearchExternalServerAuthenticationProvider.class); - mockSimpleProvider = strictMock(LogsearchSimpleAuthenticationProvider.class); - - Field ldapProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("ldapAuthenticationProvider"); - ldapProviderField.setAccessible(true); - ldapProviderField.set(provider, mockLdapProvider); - - Field fileProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("fileAuthenticationProvider"); - fileProviderField.setAccessible(true); - fileProviderField.set(provider, mockFileProvider); - - Field extarnalProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("externalServerAuthenticationProvider"); - extarnalProviderField.setAccessible(true); - extarnalProviderField.set(provider, mockExternalServerProvider); - - Field simpleProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("simpleAuthenticationProvider"); - simpleProviderField.setAccessible(true); - simpleProviderField.set(provider, mockSimpleProvider); - } - - @Test - public void testLdapAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testFileAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testExternalAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testSimpleAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, FAILED_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testOneExceptionAndAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("") {}); - expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - Authentication authenticationResult = provider.authenticate(authentication); - assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION); - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testOneExceptionNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {}); - expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown AuthenticationException", false); - } catch(AuthenticationException e) { - assertEquals(e.getMessage(), "msg1"); - } - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } - - @Test - public void testTwoExceptionNoOneAuthenticates() { - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {}); - expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {}); - expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION); - - replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown AuthenticationException", false); - } catch(AuthenticationException e) { - assertEquals(e.getMessage(), "msg1"); - } - - verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider); - } -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java deleted file mode 100644 index d6247a1..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java +++ /dev/null @@ -1,185 +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.web.security; - -import org.apache.ambari.logsearch.common.ExternalServerClient; -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchExternalServerAuthenticationProviderTest { - - private LogsearchExternalServerAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - private ExternalServerClient mockExternalServerClient; - - @Before - public void init() throws Exception { - provider = new LogsearchExternalServerAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - mockExternalServerClient = strictMock(ExternalServerClient.class); - - Field authPropsConfigField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - authPropsConfigField.setAccessible(true); - authPropsConfigField.set(provider, mockAuthPropsConfig); - - Field externalServerClientField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("externalServerClient"); - externalServerClientField.setAccessible(true); - externalServerClientField.set(provider, mockExternalServerClient); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - - @Test - public void testAuthenticationEmptyPassword() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", ""); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullPassword() { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", null); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationUnsuccessful() throws Exception { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME"); - expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials")) - .andReturn("{\"permission_name\": \"NOT.AMBARI.ADMINISTRATOR\" }"); - - replay(mockAuthPropsConfig, mockExternalServerClient); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Bad credentials", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockExternalServerClient); - } - - @Test - public void testAuthenticationSuccessful() throws Exception { - expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true); - expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME"); - expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials")) - .andReturn("{\"permission_name\": \"AMBARI.ADMINISTRATOR\" }"); - - replay(mockAuthPropsConfig, mockExternalServerClient); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - Authentication authenticationResult = provider.authenticate(authentication); - - assertEquals("principal", authenticationResult.getName()); - assertEquals("credentials", authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig, mockExternalServerClient); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java deleted file mode 100644 index 407cc83..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java +++ /dev/null @@ -1,231 +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.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.apache.ambari.logsearch.util.CommonUtil; -import org.apache.ambari.logsearch.web.model.User; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.userdetails.UserDetailsService; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.List; - -public class LogsearchFileAuthenticationProviderTest { - - private LogsearchFileAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - private UserDetailsService mockUserDetailsService; - - @Before - public void init() throws Exception { - provider = new LogsearchFileAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - mockUserDetailsService = strictMock(UserDetailsService.class); - - Field authPropsConfigField = LogsearchFileAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - authPropsConfigField.setAccessible(true); - authPropsConfigField.set(provider, mockAuthPropsConfig); - - Field userDetailsServiceField = LogsearchFileAuthenticationProvider.class.getDeclaredField("userDetailsService"); - userDetailsServiceField.setAccessible(true); - userDetailsServiceField.set(provider, mockUserDetailsService); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - - @Test - public void testAuthenticationEmptyPassword() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", ""); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullPassword() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", null); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationUnknownUser() { - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(null); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("User not found.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationNoPassword() { - List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", null, grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Password can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationWrongPassword() { - List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", CommonUtil.encryptPassword("principal", "notCredentials"), grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch (BadCredentialsException e) { - assertEquals("Wrong password.", e.getMessage()); - } - - verify(mockAuthPropsConfig, mockUserDetailsService); - } - - @Test - public void testAuthenticationSuccessful() { - List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER")); - User user = new User("principal", CommonUtil.encryptPassword("principal", "credentials"), grantedAuths); - - expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true); - expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user); - - replay(mockAuthPropsConfig, mockUserDetailsService); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - - Authentication authenticationResult = provider.authenticate(authentication); - assertEquals("principal", authenticationResult.getName()); - assertEquals(CommonUtil.encryptPassword("principal", "credentials"), authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig, mockUserDetailsService); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java deleted file mode 100644 index c6af3e2..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java +++ /dev/null @@ -1,61 +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.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; - -import static junit.framework.Assert.assertSame; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchLdapAuthenticationProviderTest { - - private LogsearchLdapAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - - @Before - public void init() throws Exception { - provider = new LogsearchLdapAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - - Field f = LogsearchLdapAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - f.setAccessible(true); - f.set(provider, mockAuthPropsConfig); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthLdapEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java deleted file mode 100644 index 7287012..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java +++ /dev/null @@ -1,118 +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.web.security; - -import org.apache.ambari.logsearch.conf.AuthPropsConfig; -import org.junit.Before; -import org.junit.Test; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.authority.SimpleGrantedAuthority; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertSame; -import static junit.framework.Assert.assertTrue; -import static org.easymock.EasyMock.strictMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.lang.reflect.Field; - -public class LogsearchSimpleAuthenticationProviderTest { - - private LogsearchSimpleAuthenticationProvider provider; - private AuthPropsConfig mockAuthPropsConfig; - - @Before - public void init() throws Exception { - provider = new LogsearchSimpleAuthenticationProvider(); - mockAuthPropsConfig = strictMock(AuthPropsConfig.class); - - Field f = LogsearchSimpleAuthenticationProvider.class.getDeclaredField("authPropsConfig"); - f.setAccessible(true); - f.set(provider, mockAuthPropsConfig); - } - - @Test - public void testAuthenticationDisabled() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(false); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - assertSame(provider.authenticate(authentication), authentication); - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationEmptyUser() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("", "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationNullUser() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken(null, "credentials"); - - try { - provider.authenticate(authentication); - assertTrue("Should have thrown BadCredentialsException", false); - } catch(BadCredentialsException e) { - assertEquals("Username can't be null or empty.", e.getMessage()); - } - - verify(mockAuthPropsConfig); - } - - @Test - public void testAuthenticationSuccessful() { - expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true); - - replay(mockAuthPropsConfig); - - Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); - - Authentication authenticationResult = provider.authenticate(authentication); - assertEquals("principal", authenticationResult.getName()); - assertEquals("credentials", authenticationResult.getCredentials()); - assertEquals(1, authenticationResult.getAuthorities().size()); - assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next()); - - verify(mockAuthPropsConfig); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json deleted file mode 100644 index 344dc3d..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/HadoopServiceConfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "service": { - "accumulo": { - "label": "TestService", - "components": [ - { - "name": "test_component1" - }, - { - "name": "test_component2" - } - ], - "dependencies": [ - ] - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties deleted file mode 100755 index 2715d1f..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties +++ /dev/null @@ -1,33 +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. - -logsearch.solr.audit.logs.config.name=test_audit_logs_config_name -logsearch.collection.audit.logs.numshards=123 -logsearch.collection.audit.logs.replication.factor=456 -logsearch.solr.collection.audit.logs=test_audit_logs_collection - -logsearch.solr.service.logs.config.name=test_service_logs_config_name -logsearch.collection.service.logs.numshards=789 -logsearch.collection.service.logs.replication.factor=987 -logsearch.solr.collection.service.logs=test_service_logs_collection -logsearch.service.logs.split.interval.mins=1 - -logsearch.solr.history.config.name=test_history_logs_config_name -logsearch.collection.history.replication.factor=234 -logsearch.solr.collection.history=test_history_logs_collection - -logsearch.auth.file.enable=true -logsearch.login.credentials.file=user_pass.json -logsearch.roles.allowed=AMBARI.ADMINISTRATOR http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json deleted file mode 100644 index 0a04afe..0000000 --- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/user_pass.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "users": [{ - "name": "Test User Name", - "username": "testUserName", - "password": "testUserPassword", - "en_password": "" - }] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/.gitignore ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/.gitignore b/ambari-logsearch/ambari-logsearch-server/.gitignore new file mode 100644 index 0000000..07e0389 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/.gitignore @@ -0,0 +1,9 @@ +target +.settings +.classpath +.project +/bin/ +node_modules/ +logs/ +node/ + http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/README.md ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/README.md b/ambari-logsearch/ambari-logsearch-server/README.md new file mode 100644 index 0000000..126f651 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/README.md @@ -0,0 +1,55 @@ +<!-- +{% comment %} +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. +{% endcomment %} +--> + +#Compilation +mvn clean compile package + +#Deploy +##Copy to remote +copy target/logsearch-portal.tar.gz to host machine +##Setup environment +```bash +mkdir /opt/logsearch +cd /opt/logsearch +tar xfz ~/logsearch-portal.tar.gz +``` +#Create Solr Collection +*Edit for log retention days (default is 7 days)* +```bash +vi solr_configsets/hadoop_logs/conf/solrconfig.xml +``` +``` + <processor class="solr.DefaultValueUpdateProcessorFactory"> + <str name="fieldName">_ttl_</str> + <str name="value">+7DAYS</str> + </processor> +``` +```bash +./create_collections.sh $SOLR_HOME $NUM_SHARDS $NUM_OF_REPLICATIONS `pwd`/solr_configsets +``` +```bash +vi classes/logsearch.properties +``` +``` +solr.zkhosts=$ZK1:2181,$ZK2:2181,$ZK3:2181/solr +``` +*This script will stop logsearch if it is running and restart it* +```bash +./run.sh +``` http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/build.properties ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/build.properties b/ambari-logsearch/ambari-logsearch-server/build.properties new file mode 100644 index 0000000..1cd118a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/build.properties @@ -0,0 +1,23 @@ +# Licensed 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. + +# log4j configuration used during build and unit tests + +TOMCAT_HOME=/Library/Tomcat/Home +app.work.dir=${builddir}/build/work +app.war.dir=${app.work.dir}/war +app.pkg.dir=${app.work.dir}/pkg + +app.dev.war.dir=${app.work.dir}/webapps/logsearch +app.war.name=logsearch.war + +app.target.dir=${builddir}/target/classes/webapps/app \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/build.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/build.xml b/ambari-logsearch/ambari-logsearch-server/build.xml new file mode 100644 index 0000000..aadacd7 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/build.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + 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. +--> +<project basedir="." default="build" name="logsearch"> + <property environment="env"/> + <property name="debuglevel" value="source,lines,vars"/> + <dirname property="builddir" file="build.xml"/> + <property name="target" value="1.7"/> + <property name="source" value="1.7"/> + <property file="build.properties"/> + + <target name="init"> + </target> + <target name="build"/> + + <target name="package"> + <delete dir="target/package"/> + <copy todir="target/package/libs" includeEmptyDirs="no"> + <fileset dir="target/libs"/> + </copy> + <copy todir="target/package/classes" includeEmptyDirs="no"> + <fileset dir="target/classes"/> + </copy> + <copy todir="target/package/solr_configsets" includeEmptyDirs="yes"> + <fileset dir="src/main/configsets"/> + </copy> + <copy todir="target/package" includeEmptyDirs="no"> + <fileset file="src/main/scripts/*"/> + </copy> + <chmod file="target/package/*.sh" perm="755"/> + <tar compression="gzip" destfile="target/ambari-logsearch-portal.tar.gz"> + <tarfileset mode="755" dir="target/package"> + <include name="*.sh"/> + </tarfileset> + <tarfileset mode="664" dir="target/package"> + <exclude name="*.sh"/> + </tarfileset> + </tar> + + </target> + + + <target description="Build all projects which reference this project. Useful to propagate changes." + name="build-refprojects"/> +</project> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml new file mode 100755 index 0000000..52bda8d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/pom.xml @@ -0,0 +1,745 @@ +<?xml version="1.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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <artifactId>ambari-logsearch</artifactId> + <groupId>org.apache.ambari</groupId> + <version>2.0.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-server</artifactId> + <packaging>jar</packaging> + <version>2.0.0.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <name>Ambari Logsearch Server</name> + <properties> + <spring.version>4.2.5.RELEASE</spring.version> + <spring.security.version>4.0.4.RELEASE</spring.security.version> + <spring.ldap.version>2.0.4.RELEASE</spring.ldap.version> + <jersey.version>2.23.2</jersey.version> + <jetty-version>9.2.11.v20150529</jetty-version> + <swagger.version>1.5.8</swagger.version> + <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version> + <jjwt.version>0.6.0</jjwt.version> + </properties> + <profiles> + <!-- Dev Profile Start --> + <profile> + <id>dev</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <build> + <finalName>LogSearch</finalName> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <!-- Exec main class plugin --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass> + <!-- <arguments> <argument></argument> </arguments> --> + </configuration> + </plugin> + <!-- copy-dependencies --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + <executions> + <execution> + <id>unpack</id> + <phase>prepare-package</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-web</artifactId> + <version>${project.version}</version> + <outputDirectory>${project.build.outputDirectory}/</outputDirectory> + <includes>webapps/**</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <artifactItems>*</artifactItems> + <excludeArtifactIds>ambari-logsearch-web</excludeArtifactIds> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + <outputDirectory>${basedir}/target/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <!-- - --> + <!-- ant pacakge --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> --> + <ant antfile="build.xml"> + <target name="package"/> + </ant> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>src/main/configsets/hadoop_logs/conf/managed-schema</exclude> + <exclude>**/*.log</exclude> + <exclude>**/*.json</exclude> + </excludes> + </configuration> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- /ant package --> + </plugins> + </build> + </profile> + <!-- Dev Profile End --> + <!-- Production Profile Start --> + <profile> + <id>production</id> + <build> + <finalName>LogSearch</finalName> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <!-- Exec main class plugin --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass> + <!-- <arguments> <argument></argument> </arguments> --> + </configuration> + </plugin> + <!-- copy-dependencies --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <artifactItems>*</artifactItems> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + <outputDirectory>${basedir}/target/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <!-- - --> + <!-- ant pacakge --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> --> + <ant antfile="build.xml"> + <target name="package"/> + </ant> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <!-- <execution> + <id>Packag Install</id> + <phase>generate-resources</phase> + <configuration> + <target> + <exec executable="npm"> + <arg value="install" /> + </exec> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>Js Packaging</id> + <phase>generate-resources</phase> + <configuration> + <target> + <exec executable="gulp"> + <arg value="minify-css" /> + </exec> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> --> + </executions> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/*</exclude> + </excludes> + </configuration> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <!-- Production Profile End --> + <profile> + <id>skipMinify</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <finalName>LogSearch</finalName> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.0</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <!-- Exec main class plugin --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass> + <!-- <arguments> <argument></argument> </arguments> --> + </configuration> + </plugin> + <!-- copy-dependencies --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.8</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <artifactItems>*</artifactItems> + <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename> + <outputDirectory>${basedir}/target/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + <!-- - --> + <!-- ant pacakge --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.7</version> + <executions> + <execution> + <phase>package</phase> + <configuration> + <target> + <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" + /> --> + <ant antfile="build.xml"> + <target name="package"/> + </ant> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>3.4</version> + <scope>test</scope> + </dependency> + <!-- Spring dependencies --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + </dependency> + <!-- Spring Security --> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + <version>${spring.security.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-core</artifactId> + <version>${spring.security.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + <version>${spring.security.version}</version> + </dependency> + + <dependency> + <groupId>org.springframework.ldap</groupId> + <artifactId>spring-ldap-core</artifactId> + <version>${spring.ldap.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-ldap</artifactId> + <version>${spring.security.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>jersey-spring3</artifactId> + <version>2.23.2</version> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.connectors</groupId> + <artifactId>jersey-apache-connector</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jettison</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + </dependency> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-solrj</artifactId> + <version>${solr.version}</version> + </dependency> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-core</artifactId> + <version>${solr.version}</version> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + <version>${solr.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + <version>${solr.version}</version> + </dependency> + <!-- Hadoop --> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <version>2.7.0</version> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + </exclusion> + <exclusion> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-util</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jersey</groupId> + <artifactId>jetty-util</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-json</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-server</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-appender</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-metrics-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.3.1</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security.kerberos</groupId> + <artifactId>spring-security-kerberos-core</artifactId> + <version>1.0.1.RELEASE</version> + </dependency> + <dependency> + <groupId>org.springframework.security.kerberos</groupId> + <artifactId>spring-security-kerberos-web</artifactId> + <version>1.0.1.RELEASE</version> + </dependency> + <dependency> + <groupId>org.springframework.security.kerberos</groupId> + <artifactId>spring-security-kerberos-client</artifactId> + <version>1.0.1.RELEASE</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-security</artifactId> + <version>${jetty-version}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>${jetty-version}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>${jetty-version}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlets</artifactId> + <version>${jetty-version}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-util</artifactId> + <version>${jetty-version}</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + <version>${jetty-version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-annotations</artifactId> + <version>${jetty-version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + <version>3.2.4</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-core</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jersey2-jaxrs</artifactId> + <version>${swagger.version}</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-models</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>org.webjars</groupId> + <artifactId>swagger-ui</artifactId> + <version>2.1.0</version> + </dependency> + <dependency> + <groupId>org.springframework.data</groupId> + <artifactId>spring-data-solr</artifactId> + <version>${spring-data-solr.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context-support</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.freemarker</groupId> + <artifactId>freemarker</artifactId> + <version>2.3.20</version> + </dependency> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt</artifactId> + <version>${jjwt.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>jersey-bean-validation</artifactId> + <version>2.25</version> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk15on</artifactId> + <version>1.55</version> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + <version>1.55</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-logsearch-web</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/run.sh ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/run.sh b/ambari-logsearch/ambari-logsearch-server/run.sh new file mode 100755 index 0000000..ea89947 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/run.sh @@ -0,0 +1,24 @@ +# Licensed 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. +echo " +âââ âââââââ âââââââ ââââââââââââââââ ââââââ âââââââ ââââââââââ âââ +âââ âââââââââââââââââ âââââââââââââââââââââââââââââââââââââââââââ âââ +âââ âââ ââââââ ââââ ââââââââââââââ âââââââââââââââââââ ââââââââ +âââ âââ ââââââ âââ ââââââââââââââ âââââââââââââââââââ ââââââââ +ââââââââââââââââââââââââââ âââââââââââââââââââ ââââââ ââââââââââââââ âââ +ââââââââ âââââââ âââââââ âââââââââââââââââââ ââââââ âââ ââââââââââ âââ +" +cd .. +mvn clean compile package -Pdev +cd ambari-logsearch-server +#mvn exec:java -Pdev +java -cp target/libs/*:target/classes/ org.apache.ambari.logsearch.LogSearch http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html new file mode 100755 index 0000000..fecab20 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.html @@ -0,0 +1,24 @@ +<!-- + 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. +--> + +<!-- The content of this page will be statically included into the top- +right box of the cores overview page. Uncomment this as an example to +see there the content will show up. + +<img src="img/ico/construction.png"> This line will appear at the top- +right box on collection1's Overview +--> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html new file mode 100755 index 0000000..3359a46 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-bottom.html @@ -0,0 +1,25 @@ +<!-- + 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. +--> + +<!-- admin-extra.menu-bottom.html --> +<!-- +<li> + <a href="#" style="background-image: url(img/ico/construction.png);"> + LAST ITEM + </a> +</li> +--> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html new file mode 100755 index 0000000..0886cee --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/admin-extra.menu-top.html @@ -0,0 +1,25 @@ +<!-- + 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. +--> + +<!-- admin-extra.menu-top.html --> +<!-- +<li> + <a href="#" style="background-image: url(img/ico/construction.png);"> + FIRST ITEM + </a> +</li> +--> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml new file mode 100644 index 0000000..25d5ceb --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/elevate.xml @@ -0,0 +1,38 @@ +<?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. +--> + +<!-- If this file is found in the config directory, it will only be + loaded once at startup. If it is found in Solr's data + directory, it will be re-loaded every commit. + + See http://wiki.apache.org/solr/QueryElevationComponent for more info + +--> +<elevate> + <query text="foo bar"> + <doc id="1" /> + <doc id="2" /> + <doc id="3" /> + </query> + + <query text="ipod"> + <doc id="MA147LL/A" /> <!-- put the actual ipod at the top --> + <doc id="IW-02" exclude="true" /> <!-- exclude this cable --> + </query> + +</elevate> http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f1e340/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml new file mode 100644 index 0000000..458ee7e --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-server/src/main/configsets/audit_logs/conf/enumsConfig.xml @@ -0,0 +1,28 @@ +<?xml version="1.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. +--> +<enumsConfig> + <enum name="log_levels"> + <value>UNKNOWN</value> + <value>TRACE</value> + <value>DEBUG</value> + <value>INFO</value> + <value>WARN</value> + <value>ERROR</value> + <value>FATAL</value> + </enum> +</enumsConfig>