updated libraries
updated to JUNIT5
This commit is contained in:
@ -17,10 +17,10 @@ package de.muehlencord.shared.account.web;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.AccountPermissions;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountException;
|
||||
import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.instance.boundary.ApplicationPermissions;
|
||||
import java.util.Arrays;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.context.Initialized;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.instance.control.ApplicationController;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import de.muehlencord.shared.account.business.instance.control.ApplicationController;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.util.AccountPU;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIInput;
|
||||
@ -12,11 +15,6 @@ import javax.faces.validator.ValidatorException;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationRoleControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.util.AccountPU;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIInput;
|
||||
@ -10,13 +11,9 @@ import javax.faces.validator.FacesValidator;
|
||||
import javax.faces.validator.Validator;
|
||||
import javax.faces.validator.ValidatorException;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package de.muehlencord.shared.account.web.presentation;
|
||||
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.business.application.control.ApplicationPermissionControl;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationPermissionEntity;
|
||||
import de.muehlencord.shared.account.util.AccountPU;
|
||||
import java.io.Serializable;
|
||||
import javax.faces.application.FacesMessage;
|
||||
|
||||
@ -54,8 +54,8 @@
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -63,6 +63,11 @@
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
|
||||
@ -163,8 +163,9 @@ public class ApiKeyService implements Serializable {
|
||||
@Transactional
|
||||
@Lock(LockType.WRITE)
|
||||
public ApiKeyObject createNewApiKey(String userName, short expirationInMinutes) throws ApiKeyException {
|
||||
if ((password == null || issuer == null) || (userName == null)) {
|
||||
LOGGER.error("password, issuer or username not set in, please validate configuration");
|
||||
if (password == null || issuer == null || userName == null) {
|
||||
String hint = "password, issuer or username not set in, please validate configuration";
|
||||
throw new ApiKeyException(hint);
|
||||
}
|
||||
Date now = DateUtil.getCurrentTimeInUTC();
|
||||
ZonedDateTime issuedOn = ZonedDateTime.ofInstant(now.toInstant(), ZoneId.of("UTC"));
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package de.muehlencord.shared.account.business.config.boundary;
|
||||
|
||||
import de.muehlencord.shared.db.ControllerException;
|
||||
import de.muehlencord.shared.account.business.account.entity.Account;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
@ -23,6 +22,7 @@ import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigEntityPK;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import de.muehlencord.shared.account.util.AccountPU;
|
||||
import de.muehlencord.shared.db.ControllerException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -37,6 +37,7 @@ import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.transaction.Transactional;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -121,7 +122,7 @@ public class ConfigService implements Serializable {
|
||||
|
||||
// if config value is not found null has been returned
|
||||
// in this case the value to return is the defaultValue
|
||||
if (configValue == null) {
|
||||
if (StringUtils.isEmpty(configValue)) {
|
||||
configValue = defaultValue;
|
||||
}
|
||||
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
*/
|
||||
package de.muehlencord.shared.account.business.instance.boundary;
|
||||
|
||||
import de.muehlencord.shared.db.ControllerException;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import de.muehlencord.shared.db.ControllerException;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.context.Initialized;
|
||||
|
||||
@ -25,13 +25,12 @@ import javax.faces.context.ExternalContext;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -15,9 +15,13 @@
|
||||
*/
|
||||
package de.muehlencord.shared.account.shiro.filter;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApiKeyService;
|
||||
import de.muehlencord.shared.account.business.account.entity.JWTObject;
|
||||
import de.muehlencord.shared.account.shiro.token.JWTAuthenticationToken;
|
||||
import de.muehlencord.shared.account.util.AccountSecurityException;
|
||||
import de.muehlencord.shared.jeeutil.restexfw.APIException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonObject;
|
||||
import javax.json.JsonReader;
|
||||
@ -29,7 +33,6 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
@ -37,12 +40,6 @@ import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.boundary.ApiKeyService;
|
||||
import de.muehlencord.shared.account.business.account.entity.JWTObject;
|
||||
import de.muehlencord.shared.account.shiro.token.JWTAuthenticationToken;
|
||||
import de.muehlencord.shared.account.util.AccountSecurityException;
|
||||
import de.muehlencord.shared.jeeutil.restexfw.APIException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
|
||||
@ -1,21 +1,98 @@
|
||||
package de.muehlencord.shared.account.business.account.boundary;
|
||||
|
||||
import org.junit.Test;
|
||||
import de.muehlencord.shared.account.business.account.control.AccountControl;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationRoleEntity;
|
||||
import de.muehlencord.shared.account.business.config.boundary.ConfigService;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigException;
|
||||
import de.muehlencord.shared.account.dao.ApiKeyObject;
|
||||
import de.muehlencord.shared.db.ControllerException;
|
||||
import java.util.ArrayList;
|
||||
import javax.persistence.EntityManager;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ApiKeyServiceTest {
|
||||
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ApiKeyServiceTest.class);
|
||||
|
||||
ApiKeyService apiKeyService;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
apiKeyService = new ApiKeyService();
|
||||
apiKeyService.configService = mock(ConfigService.class);
|
||||
try {
|
||||
when(apiKeyService.configService.getConfigValue(anyString(), anyString(), anyBoolean())).thenReturn("120");
|
||||
when(apiKeyService.configService.getConfigValue(anyString())).thenAnswer(new Answer<String>() {
|
||||
@Override
|
||||
public String answer(InvocationOnMock invocation) throws Throwable {
|
||||
Object[] args = invocation.getArguments();
|
||||
String configKey = args[0].toString();
|
||||
switch (configKey) {
|
||||
case "rest.password":
|
||||
return "secret";
|
||||
case "rest.issuer":
|
||||
return "ApiKeyServiceTest";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (ConfigException | ControllerException ex) {
|
||||
LOGGER.error(ex.getMessage());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
||||
}
|
||||
fail("An exception occured");
|
||||
}
|
||||
apiKeyService.accountControl = mock(AccountControl.class);
|
||||
when(apiKeyService.accountControl.getAccountEntity(anyString(), anyBoolean())).thenAnswer(new Answer<AccountEntity>() {
|
||||
@Override
|
||||
public AccountEntity answer(InvocationOnMock iom) throws Throwable {
|
||||
Object[] args = iom.getArguments();
|
||||
String userName = args[0].toString();
|
||||
boolean loadRoles = (boolean) args[1];
|
||||
AccountEntity account = new AccountEntity();
|
||||
account.setUsername(userName);
|
||||
account.setFirstname("FirstName");
|
||||
account.setLastname("LastName");
|
||||
if (loadRoles) {
|
||||
account.setApplicationRoleList(new ArrayList<>());
|
||||
ApplicationRoleEntity exampleRoleEntity = new ApplicationRoleEntity();
|
||||
exampleRoleEntity.setRoleName("Example Role");
|
||||
account.getApplicationRoleList().add(exampleRoleEntity);
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
||||
});
|
||||
apiKeyService.em = mock (EntityManager.class);
|
||||
apiKeyService.init();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateApiKey() {
|
||||
try {
|
||||
ApiKeyService apiKeyService = new ApiKeyService();
|
||||
apiKeyService.createNewApiKey("web", (short) 120);
|
||||
ApiKeyObject apiKeyObject = apiKeyService.createNewApiKey("web", (short) 120);
|
||||
assertNotNull(apiKeyObject);
|
||||
LOGGER.info("authToken: "+apiKeyObject.getAuthToken());
|
||||
} catch (ApiKeyException ex) {
|
||||
LOGGER.error(ex.getMessage());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
|
||||
@ -22,20 +22,20 @@ import de.muehlencord.shared.account.business.config.entity.ConfigEntity;
|
||||
import de.muehlencord.shared.account.business.config.entity.ConfigEntityPK;
|
||||
import java.util.UUID;
|
||||
import javax.persistence.EntityManager;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ConfigServiceTest {
|
||||
|
||||
@InjectMocks
|
||||
@ -44,7 +44,7 @@ public class ConfigServiceTest {
|
||||
@Mock
|
||||
private EntityManager entityManagerMock;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setId(UUID.randomUUID());
|
||||
@ -63,7 +63,7 @@ public class ConfigServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
// TODO move to account test
|
||||
public void testGetMaxFailedLogins() {
|
||||
// configService.init();
|
||||
|
||||
@ -19,10 +19,12 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.config.IniSecurityManagerFactory;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.junit.Test;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import static org.junit.Assume.assumeNotNull;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -32,27 +34,32 @@ public class UserNameActiveDirectoryRealmTest {
|
||||
|
||||
@Test
|
||||
public void testUsernameLogin() {
|
||||
String userName = "user.name";
|
||||
String userName = "root";
|
||||
String password = "secret";
|
||||
testLogin(userName, password);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void testEmailaddressLogin() {
|
||||
String userName = "user.name@domain.com";
|
||||
String password = "secret";
|
||||
Assertions.assertThrows(AuthenticationException.class, () -> {
|
||||
testLogin(userName, password);
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected=AuthenticationException.class)
|
||||
@Test
|
||||
public void testWrongUserNamePassword() {
|
||||
String userName = "test123";
|
||||
String password = "secret";
|
||||
Assertions.assertThrows(AuthenticationException.class, () -> {
|
||||
testLogin(userName, password);
|
||||
});
|
||||
}
|
||||
|
||||
private void testLogin(String userName, String password) throws AuthenticationException {
|
||||
assumeNotNull(UserNameActiveDirectoryRealmTest.class.getResource("/shiro.ini"));
|
||||
assumeFalse(UserNameActiveDirectoryRealmTest.class.getResource("/shiro.ini") == null);
|
||||
|
||||
IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:shiro.ini");
|
||||
SecurityManager securityManager = factory.getInstance();
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package de.muehlencord.shared.account.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
25
account/src/test/resources/shiro.ini
Normal file
25
account/src/test/resources/shiro.ini
Normal file
@ -0,0 +1,25 @@
|
||||
# =============================================================================
|
||||
# Tutorial INI configuration
|
||||
#
|
||||
# Usernames/passwords are based on the classic Mel Brooks' film "Spaceballs" :)
|
||||
# =============================================================================
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Users and their (optional) assigned roles
|
||||
# username = password, role1, role2, ..., roleN
|
||||
# -----------------------------------------------------------------------------
|
||||
[users]
|
||||
root = secret, admin
|
||||
guest = guest, guest
|
||||
presidentskroob = 12345, president
|
||||
darkhelmet = ludicrousspeed, darklord, schwartz
|
||||
lonestarr = vespa, goodguy, schwartz
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Roles with assigned permissions
|
||||
# roleName = perm1, perm2, ..., permN
|
||||
# -----------------------------------------------------------------------------
|
||||
[roles]
|
||||
admin = *
|
||||
schwartz = lightsaber:*
|
||||
goodguy = winnebago:drive:eagle5
|
||||
@ -19,8 +19,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -25,9 +25,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<type>jar</type>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -18,7 +18,7 @@ public class CidrToolTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testCidrConversion() {
|
||||
System.out.println (rangeToCidrList("213.55.64.0", "213.55.127.255"));
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package de.muehlencord.shared.network;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import org.apache.commons.net.util.SubnetUtils;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -17,7 +17,7 @@ public class NetworkScannerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // takes very long
|
||||
@Disabled // takes very long
|
||||
public void testScan() throws UnknownHostException {
|
||||
String ipAddress = InetAddress.getLocalHost().getHostAddress();
|
||||
SubnetUtils utils = new SubnetUtils(ipAddress, "255.255.255.0");
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,7 +14,7 @@ public class PortScannerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // takes very long
|
||||
@Disabled // takes very long
|
||||
public void testMain() {
|
||||
PortScanner portScanner = new PortScanner();
|
||||
List<PortInformation> resultList = portScanner.scan("127.0.0.1");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -7,10 +7,11 @@ import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -27,8 +28,8 @@ public class FTPConnectionTest {
|
||||
/** true, if init is complete to execute test */
|
||||
boolean initDone = false;
|
||||
|
||||
@Before
|
||||
public void initClass() {
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
System.out.println("\n[FTPConnectionTest]");
|
||||
URL testConfigURL = FTPConnectionTest.class.getResource("/test.properties");
|
||||
FileInputStream fin = null;
|
||||
@ -80,7 +81,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testList() throws FTPConnectionException {
|
||||
System.out.println("list");
|
||||
String dir = "";
|
||||
@ -92,7 +93,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testListDirsOnly() throws FTPConnectionException {
|
||||
System.out.println("listDirsOnly");
|
||||
String dir = "";
|
||||
@ -104,7 +105,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testListFilesOnly() throws FTPConnectionException {
|
||||
System.out.println("listFilesOnly");
|
||||
String dir = "";
|
||||
@ -116,7 +117,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testListLinksOnly() throws FTPConnectionException {
|
||||
System.out.println("listLinksOnly");
|
||||
String dir = "";
|
||||
@ -128,7 +129,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testUploadFile() throws FTPConnectionException {
|
||||
System.out.println("uploadFile");
|
||||
String localFilename = "";
|
||||
@ -138,7 +139,7 @@ public class FTPConnectionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testRename() throws FTPConnectionException {
|
||||
System.out.println("rename");
|
||||
String remoteOldName = "";
|
||||
|
||||
@ -9,8 +9,9 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -19,7 +20,7 @@ import org.junit.Test;
|
||||
public class HttpLayerTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testPostByMap() throws Exception {
|
||||
System.out.println("testPostByMap");
|
||||
Map<String, String[]> map = new HashMap<>();
|
||||
@ -32,7 +33,7 @@ public class HttpLayerTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testPostByMapList() throws Exception {
|
||||
System.out.println("testPostByMapList");
|
||||
List<Map<String, String[]>> list = new LinkedList<>();
|
||||
@ -45,41 +46,43 @@ public class HttpLayerTest extends BaseTest {
|
||||
map.put("url", urlValue);
|
||||
list.add(map);
|
||||
|
||||
|
||||
|
||||
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
||||
httpLayer.post(list);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testByValue() throws Exception {
|
||||
System.out.println("testByValue");
|
||||
HttpLayer httpLayer = new HttpLayer(
|
||||
"http://localhost:8080/HttpPostListener/HttpPostListener");
|
||||
HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener");
|
||||
httpLayer.post("message", "Hello World by single parameter");
|
||||
}
|
||||
|
||||
@Test(expected = MessageNotSendException.class)
|
||||
@Test
|
||||
public void testWithUnknownURL() throws MessageNotSendException {
|
||||
System.out.println("testWithUnknownURL");
|
||||
HttpLayer httpLayer = new HttpLayer(
|
||||
"http://localhost/thisURLDoesNotExist");
|
||||
HttpLayer httpLayer = new HttpLayer("http://localhost/thisURLDoesNotExist");
|
||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||
httpLayer.post("message", "Hello World by single parameter");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = MessageNotSendException.class)
|
||||
@Test
|
||||
public void testInvalidURL() throws MessageNotSendException {
|
||||
System.out.println("testInvalidURL");
|
||||
HttpLayer httpLayer = new HttpLayer("joern@muehlencord.de");
|
||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||
httpLayer.post("message", "Hello World by single parameter");
|
||||
});
|
||||
}
|
||||
|
||||
@Test(expected = MessageNotSendException.class)
|
||||
@Test
|
||||
public void testUnsupportedURL() throws MessageNotSendException {
|
||||
System.out.println("testUnsupportedURL");
|
||||
HttpLayer httpLayer = new HttpLayer("ftp://localhost");
|
||||
Assertions.assertThrows(MessageNotSendException.class, () -> {
|
||||
httpLayer.post("message", "Hello World by single parameter");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,11 +6,11 @@ import de.muehlencord.shared.network.mail.imap.ImapMailReader;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -18,13 +18,13 @@ import org.junit.Test;
|
||||
*/
|
||||
public class MailMessageUtilsTest extends BaseTest {
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
System.out.println ("\n[MailMessageUtilsTest]");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // depends on environment
|
||||
@Disabled // depends on environment
|
||||
public void testGetInstance() throws Exception {
|
||||
System.out.println("testGetInstance");
|
||||
URL testConfigURL = MailMessageUtilsTest.class.getResource("/test.properties");
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.network.mail;
|
||||
|
||||
import java.io.File;
|
||||
@ -23,8 +18,8 @@ import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeBodyPart;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -42,8 +37,8 @@ public class TestSendMail {
|
||||
@Test
|
||||
public void testSendEmail() throws AddressException, MessagingException, IOException {
|
||||
|
||||
Assume.assumeFalse(RECEIVER == null);
|
||||
Assume.assumeFalse(PASSWORD == null);
|
||||
assumeFalse(RECEIVER == null);
|
||||
assumeFalse(PASSWORD == null);
|
||||
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.host", "jomu.timelord.de");
|
||||
|
||||
@ -6,9 +6,9 @@ import de.muehlencord.shared.network.mail.MailReaderConfiguration;
|
||||
import de.muehlencord.shared.network.mail.MailReaderConnectionException;
|
||||
import de.muehlencord.shared.network.mail.MailReaderException;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeNotNull;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -33,12 +33,12 @@ public class ExchangeMailReaderTest {
|
||||
String emailaddress = null;
|
||||
|
||||
// disable tests if not all values are set
|
||||
assumeNotNull(smtpHost);
|
||||
assumeNotNull(folder);
|
||||
assumeNotNull(testFolder);
|
||||
assumeNotNull(userName);
|
||||
assumeNotNull(emailaddress);
|
||||
assumeNotNull(password);
|
||||
assumeFalse(smtpHost == null);
|
||||
assumeFalse(folder == null);
|
||||
assumeFalse(testFolder == null);
|
||||
assumeFalse(userName == null);
|
||||
assumeFalse(emailaddress == null);
|
||||
assumeFalse(password == null);
|
||||
|
||||
MailReaderConfiguration config = new MailReaderConfiguration(smtpHost, imapHost, userName, password, emailaddress);
|
||||
MailReader instance = new ExchangeMailReader(config);
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.network.mail.imap;
|
||||
|
||||
import de.muehlencord.shared.network.BaseTest;
|
||||
@ -10,10 +6,10 @@ import de.muehlencord.shared.network.mail.MailReaderConfiguration;
|
||||
import de.muehlencord.shared.network.mail.MailReaderConnectionException;
|
||||
import de.muehlencord.shared.network.mail.MailReaderException;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -28,7 +24,7 @@ public class ImapMailReaderTest extends BaseTest {
|
||||
* @throws Exception if the tests fails
|
||||
*/
|
||||
@Test
|
||||
@Ignore // depends on environment
|
||||
@Disabled // depends on environment
|
||||
public void testConnect() throws Exception {
|
||||
System.out.println("connect");
|
||||
String meta = "meta.muehlencord.intra";
|
||||
@ -40,7 +36,7 @@ public class ImapMailReaderTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // depends on environment
|
||||
@Disabled // depends on environment
|
||||
public void testGetFolder() throws Exception {
|
||||
System.out.println("getFolder");
|
||||
String meta = "meta.muehlencord.intra";
|
||||
@ -54,7 +50,7 @@ public class ImapMailReaderTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // depends on environment
|
||||
@Disabled // depends on environment
|
||||
public void testGetMessageCount() throws MailReaderConnectionException, MailReaderException {
|
||||
System.out.println("testGetMessageCount");
|
||||
String meta = "meta.muehlencord.intra";
|
||||
@ -67,7 +63,7 @@ public class ImapMailReaderTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // depends on environment
|
||||
@Disabled // depends on environment
|
||||
public void testGetSubFolder() throws MailReaderConnectionException, MailReaderException {
|
||||
System.out.println("getSubFolder");
|
||||
String meta = "meta.muehlencord.intra";
|
||||
|
||||
@ -2,9 +2,9 @@ package de.muehlencord.shared.network.whois;
|
||||
|
||||
import de.muehlencord.shared.network.BaseTest;
|
||||
import java.io.IOException;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Ignore;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,7 +14,7 @@ public class ArinWhoisParserTest extends BaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testParseArinIp() throws IOException, WhoisException {
|
||||
String whoisInformation = this.readContentFromFile("204.232.209.184.txt");
|
||||
ArinWhoisParser parser = new ArinWhoisParser();
|
||||
@ -28,7 +28,7 @@ public class ArinWhoisParserTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testParseArinDoubleIp() throws IOException, WhoisException {
|
||||
String whoisInformation = this.readContentFromFile("108.166.92.167.txt");
|
||||
ArinWhoisParser parser = new ArinWhoisParser();
|
||||
@ -42,7 +42,7 @@ public class ArinWhoisParserTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // FIXME test broken
|
||||
@Disabled // FIXME test broken
|
||||
public void testParseArinUnknown() throws IOException, WhoisException {
|
||||
String whoisInformation = this.readContentFromFile("74.95.241.217.txt");
|
||||
ArinWhoisParser parser = new ArinWhoisParser();
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package de.muehlencord.shared.network.whois;
|
||||
|
||||
import de.muehlencord.shared.network.BaseTest;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,9 +14,8 @@ import org.junit.Test;
|
||||
*/
|
||||
public class WhoisTest extends BaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testDenicWhoIs() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
// Denic answers "status: connect" only
|
||||
@ -24,14 +23,14 @@ public class WhoisTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testInternic() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
whoIsClient.execute("whois.1api.net", "egameladder.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
// TODO 184.173.67.10 whois with referal
|
||||
public void testArin() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
@ -41,28 +40,28 @@ public class WhoisTest extends BaseTest {
|
||||
whoisInformation.validate();
|
||||
assertEquals("Country", "US", whoisInformation.getNetworkInformation().getCountry());
|
||||
System.out.println("Network: " + whoisInformation.getNetwork());
|
||||
assertTrue ("Network", whoisInformation.getNetwork().contains("74.95.224.0/19"));
|
||||
assertTrue(whoisInformation.getNetwork().contains("74.95.224.0/19"), "Network");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testApnic() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
whoIsClient.execute("whois.apnic.net", "60.247.69.45");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testLacnic() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
WhoisInformation whoisInformation = whoIsClient.execute("whois.lacnic.net", "200.29.132.82");
|
||||
assertNotNull(whoisInformation);
|
||||
assertEquals("Country", "CL", whoisInformation.getNetworkInformation().getCountry());
|
||||
assertTrue ("Network", whoisInformation.getNetwork().contains("200.29.132.80/29"));
|
||||
assertTrue(whoisInformation.getNetwork().contains("200.29.132.80/29"), "Network");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testUnkown() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
// whoIsClient.execute("whois.arin.net", "174.139.180.10");
|
||||
@ -76,7 +75,7 @@ public class WhoisTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testGeneric() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
WhoisInformation info = whoIsClient.execute("85.185.91.5");
|
||||
@ -89,14 +88,13 @@ public class WhoisTest extends BaseTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testStepWise() throws WhoisException {
|
||||
Whois whoIsClient = new Whois();
|
||||
// whoIsClient.execute ("whois.ripe.net", "88.198.181.181");
|
||||
WhoisInformation whoisInformation = whoIsClient.execute("212.204.60.1");
|
||||
assertTrue ("network", whoisInformation.getNetwork().contains("212.204.60.0/24"));
|
||||
assertTrue(whoisInformation.getNetwork().contains("212.204.60.0/24"), "network");
|
||||
// whoIsClient.execute ("whois.ripe.net", "212.204.60.0");
|
||||
// whoIsClient.execute ("whois.ripe.net", "212.0.0.0/8");
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@ -2,12 +2,12 @@ package de.muehlencord.shared.pdf;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import java.lang.reflect.Type;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -7,7 +7,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.pdmodel.font.PDFont;
|
||||
import org.apache.pdfbox.pdmodel.font.PDType1Font;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package de.muehlencord.shared.pdf;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -11,25 +12,24 @@ public class DefaultTableRowTest {
|
||||
|
||||
@Test
|
||||
public void testFromJson() {
|
||||
String jsonString = "{\n" +
|
||||
" \"type\": \"de.muehlencord.shared.pdf.DefaultTableRow\",\n" +
|
||||
" \"data\": {\n" +
|
||||
" \"row\": [\n" +
|
||||
" {\n" +
|
||||
" \"text\": \"Rechnungs-Nr.:\"\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"text\": \"${invoiceNumber}\"\n" +
|
||||
" }\n" +
|
||||
" ],\n" +
|
||||
" \"isList\": false\n" +
|
||||
" }\n" +
|
||||
" }";
|
||||
|
||||
String jsonString = "{\n"
|
||||
+ " \"type\": \"de.muehlencord.shared.pdf.DefaultTableRow\",\n"
|
||||
+ " \"data\": {\n"
|
||||
+ " \"row\": [\n"
|
||||
+ " {\n"
|
||||
+ " \"text\": \"Rechnungs-Nr.:\"\n"
|
||||
+ " },\n"
|
||||
+ " {\n"
|
||||
+ " \"text\": \"${invoiceNumber}\"\n"
|
||||
+ " }\n"
|
||||
+ " ],\n"
|
||||
+ " \"isList\": false\n"
|
||||
+ " }\n"
|
||||
+ " }";
|
||||
|
||||
TableRow tableRow = GsonUtil.getInstance().fromJson(jsonString, TableRow.class);
|
||||
assertNotNull ("tableRowObject", tableRow);
|
||||
assertEquals ("column count", 2, tableRow.getColumnCount());
|
||||
assertFalse ("isList", tableRow.isList());
|
||||
assertFalse(tableRow == null, "tableRowObject");
|
||||
assertEquals(2, tableRow.getColumnCount(), "column count");
|
||||
assertFalse(tableRow.isList(), "isList");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package de.muehlencord.shared.pdf;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -4,7 +4,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -2,7 +2,7 @@ package de.muehlencord.shared.pdf;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
package de.muehlencord.shared.pdf;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -19,8 +20,8 @@ public class TextTest {
|
||||
+ "}";
|
||||
|
||||
TextElement text = GsonUtil.getInstance().fromJson(jsonString, TextElement.class);
|
||||
assertNotNull ("text object", text);
|
||||
assertEquals ("text value", "Rechnungs-Nr.:", text.getText());
|
||||
assertFalse(text == null, "text object");
|
||||
assertEquals("Rechnungs-Nr.:", text.getText(), "text value");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -25,14 +25,15 @@ import java.net.URL;
|
||||
import java.util.Date;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
*/
|
||||
@FixMethodOrder
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class PDFDocumentTest {
|
||||
|
||||
private String jsonString = null;
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
|
||||
package de.muehlencord.shared.pdf.util;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -32,7 +33,7 @@ public class ImageUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testFromFile() throws IOException {
|
||||
System.out.println ("testFromFile");
|
||||
BufferedImage img = ImageIO.read(new File ("c:/temp/dn_logo_smartteller_transparent.png"));
|
||||
|
||||
84
pom.xml
84
pom.xml
@ -73,40 +73,10 @@
|
||||
<artifactId>filter</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version> <!-- TODO needs update to v5 -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.23.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.11</version>
|
||||
<version>1.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
@ -116,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
@ -157,24 +127,24 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.8</version>
|
||||
<version>2.9.9</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.8</version>
|
||||
<version>2.9.9.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-web</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
@ -259,6 +229,38 @@
|
||||
<artifactId>prime-jwt</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Testing -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.5.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>5.5.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.5.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.28.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>2.23.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</dependencyManagement>
|
||||
@ -296,6 +298,12 @@
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.5.3</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
@ -310,6 +318,10 @@
|
||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@ -21,8 +21,9 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
|
||||
@ -15,8 +15,9 @@ package de.muehlencord.shared.security;
|
||||
|
||||
import static de.muehlencord.shared.security.Luhn.computeCheckDigit;
|
||||
import static de.muehlencord.shared.security.Luhn.validateNumber;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -2,8 +2,11 @@ package de.muehlencord.shared.security;
|
||||
|
||||
import static de.muehlencord.shared.security.OldPasswordUtil.getScryptHash;
|
||||
import static de.muehlencord.shared.security.OldPasswordUtil.validateScryptHash;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -49,9 +52,6 @@ public class OldPasswordUtilTest {
|
||||
assertNotSame(salt1, salt2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test of checkPassword method, of class PasswordUtil.
|
||||
*/
|
||||
@ -70,19 +70,19 @@ public class OldPasswordUtilTest {
|
||||
|
||||
boolean expResult = true;
|
||||
boolean result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt);
|
||||
assertEquals(expResult, result);
|
||||
assertTrue(expResult == result);
|
||||
|
||||
expResult = false;
|
||||
result = OldPasswordUtil.checkPassword(plainTextPassword2, cryptedPassword, salt);
|
||||
assertEquals(expResult, result);
|
||||
assertTrue(expResult == result);
|
||||
|
||||
expResult = false;
|
||||
result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt2);
|
||||
assertEquals(expResult, result);
|
||||
assertTrue(expResult == result);
|
||||
|
||||
expResult = false;
|
||||
result = OldPasswordUtil.checkPassword(plainTextPassword, cryptedPassword, salt3);
|
||||
assertEquals(expResult, result);
|
||||
assertTrue(expResult == result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -91,14 +91,14 @@ public class OldPasswordUtilTest {
|
||||
String randomString = OldPasswordUtil.getRandomString("test-", 32);
|
||||
System.out.println(randomString);
|
||||
assertNotNull(randomString);
|
||||
assertTrue("string must start with prefix", randomString.startsWith("test"));
|
||||
assertEquals("string length check", 32, randomString.length());
|
||||
assertTrue(randomString.startsWith("test"), "string must start with prefix");
|
||||
assertTrue(32 == randomString.length(), "string length check");
|
||||
|
||||
String randomString2 = OldPasswordUtil.getRandomString("test-", 32);
|
||||
System.out.println(randomString2);
|
||||
assertNotNull(randomString2);
|
||||
assertTrue("string must start with prefix", randomString2.startsWith("test"));
|
||||
assertEquals("string length check", 32, randomString2.length());
|
||||
assertTrue(randomString2.startsWith("test"), "string must start with prefix");
|
||||
assertTrue(32 == randomString2.length(), "string length check");
|
||||
|
||||
assertNotSame(randomString, randomString2);
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class OldPasswordUtilTest {
|
||||
String randomString = OldPasswordUtil.getRandomString("", 32);
|
||||
System.out.println(randomString);
|
||||
assertNotNull(randomString);
|
||||
assertEquals("string length check", 32, randomString.length());
|
||||
assertTrue(32 == randomString.length(), "string length check");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -118,7 +118,7 @@ public class OldPasswordUtilTest {
|
||||
String randomString = OldPasswordUtil.getRandomString(null, 32);
|
||||
System.out.println(randomString);
|
||||
assertNotNull(randomString);
|
||||
assertEquals("string length check", 32, randomString.length());
|
||||
assertTrue(32 == randomString.length(), "string length check");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,9 +146,9 @@ public class OldPasswordUtilTest {
|
||||
public void testValidateScryptHash() {
|
||||
String hash1 = getScryptHash("secret");
|
||||
String hash2 = getScryptHash("secret");
|
||||
assertTrue ("hash must match if correct password is given",validateScryptHash("secret", hash1));
|
||||
assertTrue ("hash must match if correct password is given", validateScryptHash("secret", hash2));
|
||||
assertFalse ("hash must not match if wrong password is given", validateScryptHash("secret2", hash1));
|
||||
assertTrue(validateScryptHash("secret", hash1), "hash must match if correct password is given");
|
||||
assertTrue(validateScryptHash("secret", hash2), "hash must match if correct password is given");
|
||||
assertFalse(validateScryptHash("secret2", hash1), "hash must not match if wrong password is given");
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,12 +1,11 @@
|
||||
package de.muehlencord.shared.security;
|
||||
|
||||
import de.muehlencord.shared.security.PasswordUtil;
|
||||
import java.security.SecureRandom;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.junit.BeforeClass;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -18,7 +17,7 @@ public class PasswordUtilTest {
|
||||
private static String systemSalt64Coded;
|
||||
private static byte[] systemSaltBytes;
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
public static void init() {
|
||||
secureRandom = new SecureRandom();
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public class NtlmAuthenticatorTest extends BaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testAuthentication() throws MalformedURLException, NoSuchAlgorithmException, KeyManagementException {
|
||||
SPSite instance = new SPSite(getContext());
|
||||
// instance.getRootWeb();
|
||||
|
||||
@ -14,7 +14,7 @@ public class SharepointConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testLoadFromFile() throws Exception {
|
||||
SharepointConfig c = new SharepointConfig();
|
||||
c.loadFromFile();
|
||||
|
||||
@ -23,7 +23,7 @@ import org.xml.sax.SAXException;
|
||||
public class SPListTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testFromXML() throws Exception {
|
||||
String xmlString = readFileContentFromTest("lists/testlist.xml", "UTF-8");
|
||||
SPList list = new SPList(getContext(), "{924883B9-41B7-430C-8206-151786A67319}");
|
||||
@ -32,7 +32,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void addListItemByTitle() throws NoSuchAlgorithmException, KeyManagementException, JAXBException, SAXException, ParserConfigurationException,
|
||||
IOException {
|
||||
|
||||
@ -58,7 +58,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void addListItemBigList() throws NoSuchAlgorithmException, KeyManagementException, JAXBException, SAXException, ParserConfigurationException,
|
||||
IOException {
|
||||
|
||||
@ -93,7 +93,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetListItems() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
SPList list = instance.getSpListByTitle("Questionnaire_Countries");
|
||||
@ -111,7 +111,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetListItemsQuery() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
SPList list = instance.getSpListByTitle("Questionnaire_Countries");
|
||||
@ -135,7 +135,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetLookupValueMap() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
SPList list = instance.getSpListByTitle("Questionnaire_Countries");
|
||||
@ -145,7 +145,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetColumnNameByDisplayName() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
SPList list = instance.getSpListByTitle("Questionnaire");
|
||||
@ -153,7 +153,7 @@ public class SPListTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetItemCount() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
SPList list = instance.getSpListByTitle("Questionnaire");
|
||||
|
||||
@ -18,7 +18,7 @@ public class SPListsTest extends BaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testFromXML() throws IOException, JAXBException, SAXException {
|
||||
String xmlString = readFileContentFromTest("lists/testlists.xml", "UTF-8");
|
||||
SPLists lists = new SPLists(getContext());
|
||||
@ -27,7 +27,7 @@ public class SPListsTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetListName() throws Exception {
|
||||
SPLists instance = new SPLists(getContext());
|
||||
String listName = instance.getListNameByTitle("Questionnaire");
|
||||
|
||||
@ -18,7 +18,7 @@ public class SPUserGroupTest extends BaseTest {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(SPUserGroupTest.class.getName());
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testFromXML() throws Exception {
|
||||
String xmlString = readFileContentFromTest("usergroups/user.xml", "UTF-8");
|
||||
SPUser user = new SPUser(getContext());
|
||||
@ -27,7 +27,7 @@ public class SPUserGroupTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testGetUserInfo() throws Exception {
|
||||
SPUserGroup ug = new SPUserGroup(getContext());
|
||||
String userId = ug.getUserId("wincor-nixdorf\\joern.muehlencord");
|
||||
@ -35,14 +35,14 @@ public class SPUserGroupTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testAddUserToGroup() throws Exception {
|
||||
SPUserGroup ug = new SPUserGroup(getContext());
|
||||
ug.addUserToGroup("wincor-nixdorf\\joern.muehlencord", "Test Group");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void testIsUserMemberOfGroup() throws Exception {
|
||||
SPUserGroup ug = new SPUserGroup(getContext());
|
||||
boolean result = ug.isUserMemberOfGroup("wincor-nixdorf\\joern.muehlencord", "HQ All Members");
|
||||
@ -50,7 +50,7 @@ public class SPUserGroupTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void getUserLoginNameFromEmail() throws Exception {
|
||||
SPUserGroup ug = new SPUserGroup(getContext());
|
||||
SPUser user = ug.getUserFromEmail("joern.muehlencord@wincor-nixdorf.com");
|
||||
@ -58,7 +58,7 @@ public class SPUserGroupTest extends BaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
@Disabled // Depends on available sharepoint currently
|
||||
public void getUserFromEmail() throws Exception {
|
||||
SPUserGroup ug = new SPUserGroup(getContext());
|
||||
String user1Email = "nicole.cravo@wincor-nixdorf.com";
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@ -2,8 +2,6 @@ package de.muehlencord.shared.util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@ -7,8 +7,9 @@ package de.muehlencord.shared.util;
|
||||
|
||||
import static de.muehlencord.shared.util.OSUtil.getOperationSystem;
|
||||
import static java.lang.System.getProperties;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
package de.muehlencord.shared.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -3,8 +3,8 @@ package de.muehlencord.shared.util;
|
||||
import static de.muehlencord.shared.util.StringUtil.getValueBetweenKeywords;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Basic StringUtilTests
|
||||
@ -18,6 +18,6 @@ public class StringUtilTest extends DefaultTest {
|
||||
String content = readContentFromFile("test.txt");
|
||||
|
||||
String ipAddress = getValueBetweenKeywords(content, "The IP", "has just");
|
||||
assertEquals("ipAddress", "222.184.230.118", ipAddress);
|
||||
assertEquals("222.184.230.118", ipAddress, "ipAddress");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@ import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -22,7 +22,7 @@ public class FileUtilTest {
|
||||
* @throws URISyntaxException if the testfile specification is wrong
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void testGetFilesFromDirecotry() throws FileHandlingException, URISyntaxException {
|
||||
System.out.println("testGetFilesFromDirectory");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user