You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@fineract.apache.org by Andrey Mochalov <mo...@gmail.com> on 2018/03/23 11:29:30 UTC
Spring Rest Docs for Fineract CN
Hello everyone,
My name is Andrey Mochalov. I'm from Russia. I want to participate GSOC
2018.
I have several questions about the project Fineract CN.
I try to run project fineract-cn-customer and get error:
*org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'io.mifos.anubis.config.AnubisSecurityConfigurerAdapter':
Injection of autowired dependencies failed; nested exception is
java.lang.IllegalArgumentException: Could not resolve placeholder
'system.publicKey.timestamp' in string value
"${system.publicKey.timestamp}"*
How can I fix this?
Also I want to write tests using the Spring Rest Docs for generating
documentation. For this, I write a test:
```
@Test
public void should_CreateCustomer() throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
mockMvc.perform(post("/customer")
.header("X-Tenant-Identifier", "12345")
.contentType(APPLICATION_JSON_VALUE)
.content(objectMapper.writeValueAsString(CustomerGenerator.createRandomCustomer())))
.andDo(print())
.andExpect(status().isAccepted());
}
```
And I get error:
*java.lang.AssertionError: Status Expected :202 Actual :404*
What error did I make in creating the query?
--
Andrey Mochalov
Re: Spring Rest Docs for Fineract CN
Posted by Myrle Krantz <my...@apache.org>.
Hey Andrey,
You'll need to run the service in an environment in which that
variable is set. This is the reason we have a helper class for
starting microservices in demo-server which sets variables like that.
Look in demo-server for an example of how to use this, and if you have
questions, feel free to ask. I strongly suggest using the feign
client that's already available, rather than writing something new
using mockmvc.
Best Regards,
Myrle
On Fri, Mar 23, 2018 at 12:29 PM, Andrey Mochalov
<mo...@gmail.com> wrote:
> Hello everyone,
>
> My name is Andrey Mochalov. I'm from Russia. I want to participate GSOC
> 2018.
>
> I have several questions about the project Fineract CN.
>
> I try to run project fineract-cn-customer and get error:
>
> *org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'io.mifos.anubis.config.AnubisSecurityConfigurerAdapter':
> Injection of autowired dependencies failed; nested exception is
> java.lang.IllegalArgumentException: Could not resolve placeholder
> 'system.publicKey.timestamp' in string value
> "${system.publicKey.timestamp}"*
>
> How can I fix this?
>
> Also I want to write tests using the Spring Rest Docs for generating
> documentation. For this, I write a test:
>
> ```
> @Test
> public void should_CreateCustomer() throws Exception {
> ObjectMapper objectMapper = new ObjectMapper();
> mockMvc.perform(post("/customer")
> .header("X-Tenant-Identifier", "12345")
> .contentType(APPLICATION_JSON_VALUE)
>
> .content(objectMapper.writeValueAsString(CustomerGenerator.createRandomCustomer())))
> .andDo(print())
> .andExpect(status().isAccepted());
> }
> ```
>
> And I get error:
> *java.lang.AssertionError: Status Expected :202 Actual :404*
>
> What error did I make in creating the query?
>
> --
> Andrey Mochalov
Re: Spring Rest Docs for Fineract CN
Posted by Myrle Krantz <my...@apache.org>.
Hey Andrey,
If you want to do it that way, you’ll have to create your own test harness.
You can look at Fineract-CN-Anubis in the test module and in
fineract-cn-test to get a feel for what’s required.
Best Regards,
Myrle
On Fri 23. Mar 2018 at 17:38 Andrey Mochalov <mo...@gmail.com>
wrote:
> Hello Myrle,
>
> I can say the reason why I want to use MockMVC. Spring Rest Docs is
> supposed to be used for generating documentation.
> For this we must use MockMVC, WebTestCliend or REST Assured. See more:
>
> https://docs.spring.io/spring-restdocs/docs/2.0.1.BUILD-SNAPSHOT/reference/html5/#getting-started-documentation-snippets
>
> What do you think about it?
>
> 2018-03-23 14:29 GMT+03:00 Andrey Mochalov <mo...@gmail.com>:
>
> > Hello everyone,
> >
> > My name is Andrey Mochalov. I'm from Russia. I want to participate GSOC
> > 2018.
> >
> > I have several questions about the project Fineract CN.
> >
> > I try to run project fineract-cn-customer and get error:
> >
> > *org.springframework.beans.factory.BeanCreationException: Error creating
> > bean with name 'io.mifos.anubis.config.AnubisSecurityConfigurerAdapter':
> > Injection of autowired dependencies failed; nested exception is
> > java.lang.IllegalArgumentException: Could not resolve placeholder
> > 'system.publicKey.timestamp' in string value
> > "${system.publicKey.timestamp}"*
> >
> > How can I fix this?
> >
> > Also I want to write tests using the Spring Rest Docs for generating
> > documentation. For this, I write a test:
> >
> > ```
> > @Test
> > public void should_CreateCustomer() throws Exception {
> > ObjectMapper objectMapper = new ObjectMapper();
> > mockMvc.perform(post("/customer")
> > .header("X-Tenant-Identifier", "12345")
> > .contentType(APPLICATION_JSON_VALUE)
> > .content(objectMapper.writeValueAsString(CustomerGenerator.
> > createRandomCustomer())))
> > .andDo(print())
> > .andExpect(status().isAccepted());
> > }
> > ```
> >
> > And I get error:
> > *java.lang.AssertionError: Status Expected :202 Actual :404*
> >
> > What error did I make in creating the query?
> >
> > --
> > Andrey Mochalov
> >
>
>
>
> --
> Andrey Mochalov
>
Re: Spring Rest Docs for Fineract CN
Posted by Andrey Mochalov <mo...@gmail.com>.
Hello Myrle,
I can say the reason why I want to use MockMVC. Spring Rest Docs is
supposed to be used for generating documentation.
For this we must use MockMVC, WebTestCliend or REST Assured. See more:
https://docs.spring.io/spring-restdocs/docs/2.0.1.BUILD-SNAPSHOT/reference/html5/#getting-started-documentation-snippets
What do you think about it?
2018-03-23 14:29 GMT+03:00 Andrey Mochalov <mo...@gmail.com>:
> Hello everyone,
>
> My name is Andrey Mochalov. I'm from Russia. I want to participate GSOC
> 2018.
>
> I have several questions about the project Fineract CN.
>
> I try to run project fineract-cn-customer and get error:
>
> *org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'io.mifos.anubis.config.AnubisSecurityConfigurerAdapter':
> Injection of autowired dependencies failed; nested exception is
> java.lang.IllegalArgumentException: Could not resolve placeholder
> 'system.publicKey.timestamp' in string value
> "${system.publicKey.timestamp}"*
>
> How can I fix this?
>
> Also I want to write tests using the Spring Rest Docs for generating
> documentation. For this, I write a test:
>
> ```
> @Test
> public void should_CreateCustomer() throws Exception {
> ObjectMapper objectMapper = new ObjectMapper();
> mockMvc.perform(post("/customer")
> .header("X-Tenant-Identifier", "12345")
> .contentType(APPLICATION_JSON_VALUE)
> .content(objectMapper.writeValueAsString(CustomerGenerator.
> createRandomCustomer())))
> .andDo(print())
> .andExpect(status().isAccepted());
> }
> ```
>
> And I get error:
> *java.lang.AssertionError: Status Expected :202 Actual :404*
>
> What error did I make in creating the query?
>
> --
> Andrey Mochalov
>
--
Andrey Mochalov