// Path: src/test/java/com/cisco/cta/taxii/adapter/YamlFileApplicationContextInitializer.java
// public class YamlFileApplicationContextInitializer  implements ApplicationContextInitializer<ConfigurableApplicationContext> {
//     @Override
//     public void initialize(ConfigurableApplicationContext applicationContext) {
//         try {
//             Resource resource = applicationContext.getResource("classpath:/config/application.yml");
//             YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
//             List<PropertySource<?>> yamlTestPropertiesList = sourceLoader.load("application.yml", resource);
//             yamlTestPropertiesList.forEach(yamlTestProperties -> applicationContext.getEnvironment().getPropertySources().addLast(yamlTestProperties));
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/RequestFactory.java
// @AllArgsConstructor
// public class RequestFactory {
// 
//     private final URL pollEndpoint;
//     private final ClientHttpRequestFactory httpRequestFactory;
//     private final HttpHeadersAppender httpHeadersAppender;
//     private final HttpBodyWriter httpBodyWriter;
// 
// 
//     /**
//      * Create the TAXII request.
//      *
//      * @param messageId TAXII message id.
//      * @param feed The TAXII feed.
//      * @return TAXII poll request.
//      * @throws Exception When any error occurs.
//      */
//     public ClientHttpRequest createPollRequest(String messageId, TaxiiStatus.Feed feed) throws Exception {
//         ClientHttpRequest req = httpRequestFactory.createRequest(pollEndpoint.toURI(), HttpMethod.POST);
//         httpHeadersAppender.appendTo(req.getHeaders());
//         httpBodyWriter.write(messageId, feed, req.getBody());
//         return req;
//     }
// 
//     /**
//      * Create the TAXII request.
//      *
//      * @param messageId TAXII message id.
//      * @param feed The TAXII feed name.
//      * @param resultId TAXII result id.
//      * @param resultPartNumber TAXII result part number.
//      * @return TAXII poll request.
//      * @throws Exception When any error occurs.
//      */
//     public ClientHttpRequest createFulfillmentRequest(String messageId, TaxiiStatus.Feed feed, String resultId, Integer resultPartNumber) throws Exception {
//         ClientHttpRequest req = httpRequestFactory.createRequest(pollEndpoint.toURI(), HttpMethod.POST);
//         httpHeadersAppender.appendTo(req.getHeaders());
//         httpBodyWriter.write(messageId, feed, resultId, resultPartNumber, req.getBody());
//         return req;
//     }
// 
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/PersistenceConfiguration.java
// @Configuration
// @Import({LinuxPersistenceConfiguration.class, WindowsPersistenceConfiguration.class})
// public class PersistenceConfiguration {
// 
//     @Autowired
//     private TaxiiStatusFileHandler taxiiStatusFileHandler;
// 
//     @Bean
//     public TaxiiStatusDao taxiiStatusDao() throws DatatypeConfigurationException {
//         return new TaxiiStatusDao(taxiiStatusFileHandler);
//     }
// 
//     @Bean
//     public Jaxb2Marshaller taxiiStatusMarshaller() {
//         Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
//         jaxb2Marshaller.setClassesToBeBound(TaxiiStatus.class);
//         jaxb2Marshaller.setMarshallerProperties(ImmutableMap.of(
//                 javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true));
//         return jaxb2Marshaller;
//     }
// 
// }


import static org.junit.Assert.assertNotNull;
import com.cisco.cta.taxii.adapter.YamlFileApplicationContextInitializer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.cisco.cta.taxii.adapter.RequestFactory;
import com.cisco.cta.taxii.adapter.persistence.PersistenceConfiguration;
/*
   Copyright 2015 Cisco Systems

   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 com.cisco.cta.taxii.adapter.httpclient;





@ContextConfiguration(classes = {HttpClientConfiguration.class, PersistenceConfiguration.class}, initializers = YamlFileApplicationContextInitializer.class)
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class HttpClientConfigurationTest {

    @Autowired
// Path: src/test/java/com/cisco/cta/taxii/adapter/YamlFileApplicationContextInitializer.java
// public class YamlFileApplicationContextInitializer  implements ApplicationContextInitializer<ConfigurableApplicationContext> {
//     @Override
//     public void initialize(ConfigurableApplicationContext applicationContext) {
//         try {
//             Resource resource = applicationContext.getResource("classpath:/config/application.yml");
//             YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
//             List<PropertySource<?>> yamlTestPropertiesList = sourceLoader.load("application.yml", resource);
//             yamlTestPropertiesList.forEach(yamlTestProperties -> applicationContext.getEnvironment().getPropertySources().addLast(yamlTestProperties));
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/RequestFactory.java
// @AllArgsConstructor
// public class RequestFactory {
// 
//     private final URL pollEndpoint;
//     private final ClientHttpRequestFactory httpRequestFactory;
//     private final HttpHeadersAppender httpHeadersAppender;
//     private final HttpBodyWriter httpBodyWriter;
// 
// 
//     /**
//      * Create the TAXII request.
//      *
//      * @param messageId TAXII message id.
//      * @param feed The TAXII feed.
//      * @return TAXII poll request.
//      * @throws Exception When any error occurs.
//      */
//     public ClientHttpRequest createPollRequest(String messageId, TaxiiStatus.Feed feed) throws Exception {
//         ClientHttpRequest req = httpRequestFactory.createRequest(pollEndpoint.toURI(), HttpMethod.POST);
//         httpHeadersAppender.appendTo(req.getHeaders());
//         httpBodyWriter.write(messageId, feed, req.getBody());
//         return req;
//     }
// 
//     /**
//      * Create the TAXII request.
//      *
//      * @param messageId TAXII message id.
//      * @param feed The TAXII feed name.
//      * @param resultId TAXII result id.
//      * @param resultPartNumber TAXII result part number.
//      * @return TAXII poll request.
//      * @throws Exception When any error occurs.
//      */
//     public ClientHttpRequest createFulfillmentRequest(String messageId, TaxiiStatus.Feed feed, String resultId, Integer resultPartNumber) throws Exception {
//         ClientHttpRequest req = httpRequestFactory.createRequest(pollEndpoint.toURI(), HttpMethod.POST);
//         httpHeadersAppender.appendTo(req.getHeaders());
//         httpBodyWriter.write(messageId, feed, resultId, resultPartNumber, req.getBody());
//         return req;
//     }
// 
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/PersistenceConfiguration.java
// @Configuration
// @Import({LinuxPersistenceConfiguration.class, WindowsPersistenceConfiguration.class})
// public class PersistenceConfiguration {
// 
//     @Autowired
//     private TaxiiStatusFileHandler taxiiStatusFileHandler;
// 
//     @Bean
//     public TaxiiStatusDao taxiiStatusDao() throws DatatypeConfigurationException {
//         return new TaxiiStatusDao(taxiiStatusFileHandler);
//     }
// 
//     @Bean
//     public Jaxb2Marshaller taxiiStatusMarshaller() {
//         Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
//         jaxb2Marshaller.setClassesToBeBound(TaxiiStatus.class);
//         jaxb2Marshaller.setMarshallerProperties(ImmutableMap.of(
//                 javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true));
//         return jaxb2Marshaller;
//     }
// 
// }


// Path: src/test/java/com/cisco/cta/taxii/adapter/httpclient/HttpClientConfigurationTest.java
import static org.junit.Assert.assertNotNull;
import com.cisco.cta.taxii.adapter.YamlFileApplicationContextInitializer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.cisco.cta.taxii.adapter.RequestFactory;
import com.cisco.cta.taxii.adapter.persistence.PersistenceConfiguration;

/*
   Copyright 2015 Cisco Systems

   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 com.cisco.cta.taxii.adapter.httpclient;





@ContextConfiguration(classes = {HttpClientConfiguration.class, PersistenceConfiguration.class}, initializers = YamlFileApplicationContextInitializer.class)
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class HttpClientConfigurationTest {

    @Autowired
    private RequestFactory requestFactory;