// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/TaxiiStatus.java
// @Data
// @XmlRootElement(name="taxii-status")
// @XmlAccessorType(XmlAccessType.NONE)
// public class TaxiiStatus {
// 
//     @XmlElement
//     private final List<Feed> feed = new ArrayList<>();
//     
//     
//     /**
//      * JAXB annotated class holding consumption status of a single TAXII feed.
//      * @see TaxiiStatusDao
//      */
//     @Data
//     @XmlAccessorType(XmlAccessType.NONE)
//     public static class Feed {
//         
//         @XmlAttribute
//         private String name;
// 
//         @XmlAttribute
//         private XMLGregorianCalendar lastUpdate;
// 
//         @XmlAttribute
//         private Boolean more;
// 
//         @XmlAttribute
//         private String resultId;
// 
//         @XmlAttribute
//         private Integer resultPartNumber;
// 
//         @XmlAttribute
//         private Integer ioErrorCount;
// 
//     }
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/TaxiiStatusDao.java
// public class TaxiiStatusDao {
// 
//     private static final Logger LOG = LoggerFactory.getLogger(TaxiiStatusDao.class);
//     
//     private final TaxiiStatusFileHandler fileHandler;
//     private TaxiiStatus dirtyStatus;
// 
//     public TaxiiStatusDao(TaxiiStatusFileHandler fileHandler) {
//         this.fileHandler = fileHandler;
//         dirtyStatus = fileHandler.load();
//         if (dirtyStatus == null) {
//             LOG.warn("TAXII status file not found, all feeds will be fully downloaded");
//             dirtyStatus = new TaxiiStatus();
//         } else {
//             LOG.debug("TAXII status file loaded: {}", dirtyStatus);
//         }
//     }
// 
//     public Feed find(String feedName) {
//         for (Feed feed : dirtyStatus.getFeed()) {
//             if (feed.getName().equals(feedName)) {
//                 return feed;
//             }
//         }
//         return null;
//     }
// 
//     public synchronized void updateOrAdd(Feed feed) {
//         Feed savedFeed = find(feed.getName());
//         if (savedFeed != null) {
//             savedFeed.setMore(feed.getMore());
//             savedFeed.setResultId(feed.getResultId());
//             savedFeed.setResultPartNumber(feed.getResultPartNumber());
//             savedFeed.setLastUpdate(feed.getLastUpdate());
//         } else {
//             dirtyStatus.getFeed().add(feed);
//         }
//         fileHandler.save(dirtyStatus);
//     }
// 
// }


import com.cisco.cta.taxii.adapter.persistence.TaxiiStatus;
import com.cisco.cta.taxii.adapter.persistence.TaxiiStatusDao;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.client.ClientHttpResponse;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamResult;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import static org.mockito.Answers.RETURNS_MOCKS;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
/*
   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;




public class ResponseTransformerTest {

    private ResponseTransformer responseTransformer;

    @Mock
    private TaxiiPollResponseReaderFactory readerFactory;

    @Mock
    private Writer logWriter;

    @Mock
// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/TaxiiStatus.java
// @Data
// @XmlRootElement(name="taxii-status")
// @XmlAccessorType(XmlAccessType.NONE)
// public class TaxiiStatus {
// 
//     @XmlElement
//     private final List<Feed> feed = new ArrayList<>();
//     
//     
//     /**
//      * JAXB annotated class holding consumption status of a single TAXII feed.
//      * @see TaxiiStatusDao
//      */
//     @Data
//     @XmlAccessorType(XmlAccessType.NONE)
//     public static class Feed {
//         
//         @XmlAttribute
//         private String name;
// 
//         @XmlAttribute
//         private XMLGregorianCalendar lastUpdate;
// 
//         @XmlAttribute
//         private Boolean more;
// 
//         @XmlAttribute
//         private String resultId;
// 
//         @XmlAttribute
//         private Integer resultPartNumber;
// 
//         @XmlAttribute
//         private Integer ioErrorCount;
// 
//     }
// }
// 
// Path: src/main/java/com/cisco/cta/taxii/adapter/persistence/TaxiiStatusDao.java
// public class TaxiiStatusDao {
// 
//     private static final Logger LOG = LoggerFactory.getLogger(TaxiiStatusDao.class);
//     
//     private final TaxiiStatusFileHandler fileHandler;
//     private TaxiiStatus dirtyStatus;
// 
//     public TaxiiStatusDao(TaxiiStatusFileHandler fileHandler) {
//         this.fileHandler = fileHandler;
//         dirtyStatus = fileHandler.load();
//         if (dirtyStatus == null) {
//             LOG.warn("TAXII status file not found, all feeds will be fully downloaded");
//             dirtyStatus = new TaxiiStatus();
//         } else {
//             LOG.debug("TAXII status file loaded: {}", dirtyStatus);
//         }
//     }
// 
//     public Feed find(String feedName) {
//         for (Feed feed : dirtyStatus.getFeed()) {
//             if (feed.getName().equals(feedName)) {
//                 return feed;
//             }
//         }
//         return null;
//     }
// 
//     public synchronized void updateOrAdd(Feed feed) {
//         Feed savedFeed = find(feed.getName());
//         if (savedFeed != null) {
//             savedFeed.setMore(feed.getMore());
//             savedFeed.setResultId(feed.getResultId());
//             savedFeed.setResultPartNumber(feed.getResultPartNumber());
//             savedFeed.setLastUpdate(feed.getLastUpdate());
//         } else {
//             dirtyStatus.getFeed().add(feed);
//         }
//         fileHandler.save(dirtyStatus);
//     }
// 
// }


// Path: src/test/java/com/cisco/cta/taxii/adapter/ResponseTransformerTest.java
import com.cisco.cta.taxii.adapter.persistence.TaxiiStatus;
import com.cisco.cta.taxii.adapter.persistence.TaxiiStatusDao;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.client.ClientHttpResponse;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamResult;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import static org.mockito.Answers.RETURNS_MOCKS;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

/*
   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;




public class ResponseTransformerTest {

    private ResponseTransformer responseTransformer;

    @Mock
    private TaxiiPollResponseReaderFactory readerFactory;

    @Mock
    private Writer logWriter;

    @Mock
    private TaxiiStatusDao taxiiStatusDao;