Merge branch 'master' into Multiple_VHost_Connection

Conflicts:
	hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java
	hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java


Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-02-29 12:41:52 +01:00
122 changed files with 1256 additions and 3332 deletions

View File

@@ -56,7 +56,8 @@ public class ExcludePathAwareShallowETagFilterTest {
filterUnderTest.doFilterInternal(servletRequestMock, servletResponseMock, filterChainMock);
// verify no eTag header is set and response has not been changed
assertThat(servletResponseMock.getHeader("ETag")).isNull();
assertThat(servletResponseMock.getHeader("ETag"))
.as("ETag header should not be set during downloading, too expensive").isNull();
// the servlet response must be the same mock!
verify(filterChainMock, times(1)).doFilter(servletRequestMock, servletResponseMock);
}

View File

@@ -53,7 +53,8 @@ public class IpUtilTest {
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux");
// verify
assertThat(remoteAddr).isEqualTo(knownRemoteClientIP);
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
.isEqualTo(knownRemoteClientIP);
verify(requestMock, times(1)).getHeader("bumlux");
verify(requestMock, times(1)).getRemoteAddr();
}
@@ -71,7 +72,8 @@ public class IpUtilTest {
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "X-Forwarded-For");
// verify
assertThat(remoteAddr).isEqualTo(knownRemoteClientIP);
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
.isEqualTo(knownRemoteClientIP);
verify(requestMock, times(1)).getHeader(HttpHeaders.X_FORWARDED_FOR);
verify(requestMock, times(0)).getRemoteAddr();
}
@@ -94,10 +96,10 @@ public class IpUtilTest {
}
private void assertHttpUri(final String host, final URI httpUri) {
assertTrue(IpUtil.isHttpUri(httpUri));
assertFalse(IpUtil.isAmqpUri(httpUri));
assertEquals(host, httpUri.getHost());
assertEquals("http", httpUri.getScheme());
assertTrue("The given URI has an http scheme", IpUtil.isHttpUri(httpUri));
assertFalse("The given URI is not an AMQP scheme", IpUtil.isAmqpUri(httpUri));
assertEquals("The URI hosts matches the given host", host, httpUri.getHost());
assertEquals("The given URI scheme is http", "http", httpUri.getScheme());
}
@Test
@@ -117,23 +119,27 @@ public class IpUtilTest {
}
private void assertAmqpUri(final String host, final URI amqpUri) {
assertTrue(IpUtil.isAmqpUri(amqpUri));
assertFalse(IpUtil.isHttpUri(amqpUri));
assertEquals(host, amqpUri.getHost());
assertEquals("amqp", amqpUri.getScheme());
assertEquals("/path", amqpUri.getRawPath());
assertTrue("The given URI is an AMQP scheme", IpUtil.isAmqpUri(amqpUri));
assertFalse("The given URI is not an HTTP scheme", IpUtil.isHttpUri(amqpUri));
assertEquals("The given host matches the URI host", host, amqpUri.getHost());
assertEquals("The given URI has an AMQP scheme", "amqp", amqpUri.getScheme());
assertEquals("The given URI has an AMQP path", "/path", amqpUri.getRawPath());
}
@Test(expected = IllegalArgumentException.class)
@Test
@Description("Tests create invalid uri")
public void testCreateInvalidUri() {
final String host = "10.99.99.1";
final URI testUri = IpUtil.createUri("test", host);
assertFalse(IpUtil.isAmqpUri(testUri));
assertFalse(IpUtil.isHttpUri(testUri));
assertEquals(host, testUri.getHost());
IpUtil.createUri(":/", host);
fail();
assertFalse("The given URI is not an AMQP address", IpUtil.isAmqpUri(testUri));
assertFalse("The given URI is not an HTTP address", IpUtil.isHttpUri(testUri));
assertEquals("The given host matches the URI host", host, testUri.getHost());
try {
IpUtil.createUri(":/", host);
fail("Missing expected IllegalArgumentException due invalid URI");
} catch (final IllegalArgumentException e) {
// expected
}
}
}