-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move runtime dependency to swagger in nflow-jetty to build time depen…
…dency in nflow-rest-api
- Loading branch information
Showing
9 changed files
with
80 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 3 additions & 26 deletions
29
...etty/src/test/java/com/nitorcreations/nflow/jetty/config/NflowJettyConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,22 @@ | ||
package com.nitorcreations.nflow.jetty.config; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
import static org.junit.Assert.assertThat; | ||
import static org.mockito.Matchers.anyInt; | ||
import static org.mockito.Matchers.anyString; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
import org.springframework.core.env.Environment; | ||
|
||
import com.wordnik.swagger.jaxrs.config.BeanConfig; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class NflowJettyConfigurationTest { | ||
|
||
@Mock | ||
private Environment env; | ||
|
||
@Test | ||
public void swaggerBasepathBuildingWorks() { | ||
when(env.getProperty(eq("swagger.basepath.protocol"), anyString())).thenReturn("https"); | ||
when(env.getProperty(eq("swagger.basepath.server"), anyString())).thenReturn("foobar"); | ||
when(env.getProperty(eq("swagger.basepath.port"), eq(Integer.class), anyInt())).thenReturn(123); | ||
when(env.getProperty(eq("swagger.basepath.context"), anyString())).thenReturn("/nflow"); | ||
NflowJettyConfiguration config = new NflowJettyConfiguration(); | ||
config.env = env; | ||
BeanConfig swaggerConfig = config.swaggerConfig(); | ||
assertThat(swaggerConfig.getBasePath(), is("https://foobar:123/nflow")); | ||
public void createsValidationExceptionMapper() { | ||
assertThat(new NflowJettyConfiguration().validationExceptionMapper(), notNullValue()); | ||
} | ||
|
||
@Test | ||
public void swaggerBasepathPropertyWorks() { | ||
when(env.getProperty("swagger.basepath")).thenReturn("https://bar:123/foo"); | ||
NflowJettyConfiguration config = new NflowJettyConfiguration(); | ||
config.env = env; | ||
BeanConfig swaggerConfig = config.swaggerConfig(); | ||
assertThat(swaggerConfig.getBasePath(), is("https://bar:123/foo")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
nflow-tests/src/test/java/com/nitorcreations/nflow/tests/runner/NflowServerRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters