View Javadoc
1   /*
2    * Copyright 2010-2019 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18  */
19  package com.hack23.cia.service.impl.action.admin;
20  
21  import org.junit.Test;
22  
23  import com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest;
24  import com.hack23.cia.service.api.action.admin.UpdateSearchIndexResponse;
25  import com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest;
26  import com.hack23.cia.service.api.action.common.ServiceResponse.ServiceResult;
27  import com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest;
28  
29  /**
30   * The Class UpdateSearchIndexServiceITest.
31   */
32  public final class UpdateSearchIndexServiceITest extends AbstractServiceFunctionalIntegrationTest {
33  
34  	/**
35  	 * Test.
36  	 *
37  	 * @throws Exception
38  	 *             the exception
39  	 */
40  	@Test
41  	public void Test() throws Exception {
42  		setAuthenticatedAdminuser();
43  		final CreateApplicationSessionRequest createSessionRequest = createTestApplicationSession();
44  
45  		final UpdateSearchIndexRequest serviceRequest = new UpdateSearchIndexRequest();
46  		serviceRequest.setSessionId(createSessionRequest.getSessionId());
47  
48  		final UpdateSearchIndexResponse response = (UpdateSearchIndexResponse) applicationManager
49  				.service(serviceRequest);
50  		assertNotNull(EXPECT_A_RESULT, response);
51  	}
52  
53  	/**
54  	 * Service request validation failure test.
55  	 *
56  	 * @throws Exception
57  	 *             the exception
58  	 */
59  	@Test
60  	public void serviceRequestValidationFailureTest() throws Exception {
61  		setAuthenticatedAdminuser();
62  		final UpdateSearchIndexRequest serviceRequest = new UpdateSearchIndexRequest();
63  
64  		final UpdateSearchIndexResponse response = (UpdateSearchIndexResponse) applicationManager
65  				.service(serviceRequest);
66  		assertNotNull(EXPECT_A_RESULT, response);
67  		assertEquals(EXPECT_SUCCESS, ServiceResult.FAILURE,response.getResult());
68  		assertEquals("sessionId must not be null", response.getErrorMessage());
69  	}
70  
71  }