Skip to content

Commit

Permalink
jwt, very base unit test at resource server side
Browse files Browse the repository at this point in the history
  • Loading branch information
cmangeat committed Nov 23, 2020
1 parent ac82e27 commit 4b0cfe9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
description = "Proxy for ElasticSearch catalog search operations")
@Controller
public class XsltSearchController {

public
@Autowired
ElasticSearchProxy proxy;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* (c) 2020 Open Source Geospatial Foundation - all rights reserved This code is licensed under the
* GPL 2.0 license, available at the root application directory.
*/

package org.fao.geonet.searching;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.fao.geonet.common.search.ElasticSearchProxy;
import org.fao.geonet.searching.controller.XsltSearchController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
@AutoConfigureTestDatabase
public class MainSearchTest {

@Autowired
private MockMvc mockMvc;

@Autowired
private XsltSearchController xsltSearchController;

@Test
public void nominal() throws Exception {
xsltSearchController.proxy = Mockito.mock(ElasticSearchProxy.class);
this.mockMvc.perform(post("/portal/api/search/records/xslt")).andDo(print()).andExpect(status().isOk());
}


}

0 comments on commit 4b0cfe9

Please sign in to comment.