diff --git a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageControllerTest.java b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageControllerTest.java index 333e928d..49e5a2ba 100644 --- a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageControllerTest.java +++ b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageControllerTest.java @@ -29,35 +29,10 @@ import static org.hamcrest.Matchers.equalTo; * */ -//@EnableAutoConfiguration(exclude= PersistenceJPAConfig.class) -//@ComponentScan(basePackages = {"hirs.attestationca.portal"}, -// excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASSIGNABLE_TYPE, -// value = {PersistenceJPAConfig.class})}) -//@ComponentScan(excludeFilters={@ComponentScan.Filter( -// type= FilterType.ASSIGNABLE_TYPE, -// value=PersistenceJPAConfig.class)}) -//@ComponentScan(basePackages = {"hirs.attestationca.portal"}, -// excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASSIGNABLE_TYPE, -// classes = {PersistenceJPAConfig.class})}) -//@ComponentScan(excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASSIGNABLE_TYPE, -// classes = {PersistenceJPAConfig.class})}) -//@ComponentScan(basePackages = {"hirs"}, -// excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASPECTJ, -// classes = {PersistenceJPAConfig.class})}) -//@WebAppConfiguration -//@ExtendWith(SpringExtension.class) -//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes={ PageTestConfiguration.class}) -//@SpringBootTest(classes={ PageTestConfiguration.class}) @SpringBootTest -//@Profile("test") @ActiveProfiles("test") @TestInstance(TestInstance.Lifecycle.PER_CLASS) // needed to use non-static BeforeAll @ContextConfiguration(classes = PageTestConfiguration.class) -//@ContextConfiguration(classes = {HIRSApplication.class, PageTestConfiguration.class}) public abstract class PageControllerTest { private String prePrefixPath = "HIRS_AttestationCAPortal/portal/"; diff --git a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageTestConfiguration.java b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageTestConfiguration.java index a608107b..01d49b6a 100644 --- a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageTestConfiguration.java +++ b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/PageTestConfiguration.java @@ -30,21 +30,9 @@ import java.util.Properties; * A configuration class for testing Attestation CA Portal classes that require a database. * This apparently is needed to appease spring tests in the TestNG runner. */ -//@Profile("test") @Import({ PageConfiguration.class }) @TestConfiguration -//@ComponentScan(excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASSIGNABLE_TYPE, -// classes = {PersistenceJPAConfig.class})}) -//@ComponentScan(basePackages = {"hirs"}, -// excludeFilters = {@ComponentScan.Filter( -// type = FilterType.ASPECTJ, -// classes = {PersistenceJPAConfig.class})}) -//@EnableAutoConfiguration(exclude= hibernate.properties) -//@TestPropertySource(value = "classpath:application-test.properties") -//@Configuration @EnableJpaRepositories(basePackages = "hirs.attestationca.persist.entity.manager") -//@EnableTransactionManagement public class PageTestConfiguration { /** @@ -63,8 +51,6 @@ public class PageTestConfiguration { * @throws IOException exception reading the file */ @Bean - //@Bean("test_acaCertificate") - //@Primary public X509Certificate acaCertificate() throws URISyntaxException, IOException { CertificateAuthorityCredential credential = new CertificateAuthorityCredential( @@ -80,8 +66,6 @@ public class PageTestConfiguration { * @return test data source */ @Bean - //@Bean("test_dataSource") - //@Primary public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .generateUniqueName(true) @@ -95,9 +79,7 @@ public class PageTestConfiguration { * * @return session factory */ - //@Bean("test_entityMangerFactory") @Bean - //@Primary public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean entityManagerBean = new LocalContainerEntityManagerFactoryBean(); @@ -118,18 +100,6 @@ public class PageTestConfiguration { */ final Properties hibernateProperties() { final Properties hibernateProperties = new Properties(); -// hibernateProperties.setProperty("hibernate.hbm2ddl.auto", -// "create"); -// hibernateProperties.setProperty("hibernate.dialect", -// "org.hibernate.dialect.HSQLDialect"); -// hibernateProperties.setProperty("hibernate.current_session_context_class", -// "thread"); - - - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.hbm2ddl.auto: " + environment.getProperty("hibernate.hbm2ddl.auto")); - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.dialect: " + environment.getProperty("hibernate.dialect")); - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.connection.username: " + environment.getProperty("hibernate.connection.username")); - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.connection.password: " + environment.getProperty("hibernate.connection.password")); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", environment.getProperty("hibernate.hbm2ddl.auto")); @@ -137,21 +107,10 @@ public class PageTestConfiguration { environment.getProperty("hibernate.dialect")); hibernateProperties.setProperty("hibernate.current_session_context_class", "thread"); -// -// hibernateProperties.setProperty("hibernate.connection.username", -// null); -// hibernateProperties.setProperty("hibernate.connection.password", -// null); - - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.hbm2ddl.auto: " + environment.getProperty("hibernate.hbm2ddl.auto")); - System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.dialect: " + environment.getProperty("hibernate.dialect")); - //System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.connection.username: " + environment.getProperty("hibernate.connection.username")); - //System.out.println("\nXXXXXXXXXXXXXXXXXXXXXXX hibernate.connection.password: " + environment.getProperty("hibernate.connection.password")); return hibernateProperties; } - /** * Generates JPA transaction manager. * diff --git a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/controllers/DevicePageControllerTest.java b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/controllers/DevicePageControllerTest.java index 16bcfaed..c8c88a5c 100644 --- a/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/controllers/DevicePageControllerTest.java +++ b/HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/controllers/DevicePageControllerTest.java @@ -26,12 +26,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. /** * Integration tests that test the URL End Points of DevicePageController. */ -//@WebAppConfiguration -//@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) public class DevicePageControllerTest extends PageControllerTest { private static final String DEVICE_NAME = "Test Device - dell-lat-l-02"; - //private static final String DEVICE_GROUP_NAME = "Test Device Group"; private static final String TEST_ENDORSEMENT_CREDENTIAL = "/endorsement_credentials/tpmcert.pem"; private static final String TEST_ENDORSEMENT_CREDENTIAL_2 @@ -63,11 +60,6 @@ public class DevicePageControllerTest extends PageControllerTest { device = new Device(DEVICE_NAME,null, HealthStatus.TRUSTED, AppraisalStatus.Status.PASS,null,false,"tmp_overrideReason", "tmp_summId"); device = deviceRepository.save(device); - System.out.println("\nUUID:" + device.getId()); - System.out.println("Number of devices:" + deviceRepository.count()); - System.out.println("List of info for each device:"); - System.out.println(deviceRepository.findAll()); - //Upload and save EK Cert EndorsementCredential ec = (EndorsementCredential) getTestCertificate(EndorsementCredential.class,