updated license headers
This commit is contained in:
@ -1,62 +1,76 @@
|
||||
|
||||
package de.muehlencord.shared.account.business.config.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
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.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ConfigServiceTest {
|
||||
|
||||
@InjectMocks
|
||||
private ConfigService configService;
|
||||
|
||||
@Mock
|
||||
private EntityManager entityManagerMock;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setId(UUID.randomUUID());
|
||||
application.setApplicationName("Test App");
|
||||
|
||||
AccountEntity account = new AccountEntity();
|
||||
account.setUsername("system");
|
||||
AccountLoginEntity login = new AccountLoginEntity();
|
||||
login.setAccount (account);
|
||||
account.setAccountLogin(login);
|
||||
|
||||
ConfigEntityPK pk = new ConfigEntityPK(application, "account.maxFailedLogins", account);
|
||||
ConfigEntity configEntity = new ConfigEntity (pk);
|
||||
configEntity.setConfigValue("7");
|
||||
when (entityManagerMock.find(ConfigEntity.class, "account.maxFailedLogins")).thenReturn (configEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
// TODO move to account test
|
||||
public void testGetMaxFailedLogins() {
|
||||
// configService.init();
|
||||
// assertEquals ("maxFailedLogins", 7, configService.getMaxFailedLogins());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2018 joern.muehlencord.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.business.config.boundary;
|
||||
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountEntity;
|
||||
import de.muehlencord.shared.account.business.account.entity.AccountLoginEntity;
|
||||
import de.muehlencord.shared.account.business.application.entity.ApplicationEntity;
|
||||
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.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ConfigServiceTest {
|
||||
|
||||
@InjectMocks
|
||||
private ConfigService configService;
|
||||
|
||||
@Mock
|
||||
private EntityManager entityManagerMock;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setId(UUID.randomUUID());
|
||||
application.setApplicationName("Test App");
|
||||
|
||||
AccountEntity account = new AccountEntity();
|
||||
account.setUsername("system");
|
||||
AccountLoginEntity login = new AccountLoginEntity();
|
||||
login.setAccount (account);
|
||||
account.setAccountLogin(login);
|
||||
|
||||
ConfigEntityPK pk = new ConfigEntityPK(application, "account.maxFailedLogins", account);
|
||||
ConfigEntity configEntity = new ConfigEntity (pk);
|
||||
configEntity.setConfigValue("7");
|
||||
when (entityManagerMock.find(ConfigEntity.class, "account.maxFailedLogins")).thenReturn (configEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
// TODO move to account test
|
||||
public void testGetMaxFailedLogins() {
|
||||
// configService.init();
|
||||
// assertEquals ("maxFailedLogins", 7, configService.getMaxFailedLogins());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2018 joern.muehlencord.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.shiro.realm;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
||||
@ -1,22 +1,32 @@
|
||||
/*
|
||||
* 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.account.util;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
public class SecurityUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreatePassword() {
|
||||
System.out.println (SecurityUtil.createPassword("secret"));
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2018 joern.muehlencord.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package de.muehlencord.shared.account.util;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
||||
*/
|
||||
public class SecurityUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testCreatePassword() {
|
||||
System.out.println (SecurityUtil.createPassword("secret"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user