* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr;
+package org.onap.dmaap.dmf.mr;
import org.json.JSONObject;
-import com.att.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
import com.att.nsa.apiServer.NsaAppException;
public class CambriaApiException extends NsaAppException
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr;
+package org.onap.dmaap.dmf.mr;
import java.io.IOException;
import java.io.InputStream;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends;
+package org.onap.dmaap.dmf.mr.backends;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends;
+package org.onap.dmaap.dmf.mr.backends;
import java.util.Collection;
import java.util.HashMap;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
/**
* This is the factory class to instantiate the consumer
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends;
+package org.onap.dmaap.dmf.mr.backends;
import com.att.nsa.metrics.CdmMetricsRegistry;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends;
+package org.onap.dmaap.dmf.mr.backends;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.kafka.clients.producer.ProducerRecord;
-import com.att.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
/**
* A publisher interface. Publishers receive messages and post them to a topic.
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.KafkaException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.util.ArrayList;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.io.IOException;
import java.net.InetAddress;
import org.springframework.context.annotation.ComponentScan;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.exception.DMaaPErrorMessages;
-import com.att.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
import com.att.eelf.configuration.EELFLogger;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.util.List;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.io.IOException;
import java.util.ArrayList;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Qualifier;
-import com.att.dmf.mr.backends.Publisher;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.utils.Utils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import com.att.eelf.configuration.EELFLogger;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.kafka;
+package org.onap.dmaap.dmf.mr.backends.kafka;
import java.util.List;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.memory;
+package org.onap.dmaap.dmf.mr.backends.memory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
/**
*
* @author anowarul.islam
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.memory;
+package org.onap.dmaap.dmf.mr.backends.memory;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Set;
import java.util.TreeSet;
-import com.att.dmf.mr.metabroker.Broker;
-import com.att.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.metabroker.Broker;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
import com.att.nsa.configs.ConfigDb;
import com.att.nsa.security.NsaAcl;
import com.att.nsa.security.NsaApiKey;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.memory;
+package org.onap.dmaap.dmf.mr.backends.memory;
import java.util.ArrayList;
import java.util.HashMap;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
/**
* When broker type is memory, then this class is doing all the topic related
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.memory;
+package org.onap.dmaap.dmf.mr.backends.memory;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.kafka.clients.producer.ProducerRecord;
-import com.att.dmf.mr.backends.Publisher;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.backends.memory;
+package org.onap.dmaap.dmf.mr.backends.memory;
import java.io.File;
import java.io.FileNotFoundException;
import org.apache.kafka.clients.producer.ProducerRecord;
-import com.att.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.io.Serializable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.util.Date;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.exception.DMaaPResponseCode;
-import com.att.dmf.mr.exception.ErrorResponse;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPResponseCode;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import com.att.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
/**
* DMaaPContext provide and maintain all the configurations , Http request/response
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.springframework.beans.factory.annotation.Qualifier;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.ConsumerFactory;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.backends.kafka.Kafka011Consumer;
-import com.att.dmf.mr.backends.kafka.Kafka011ConsumerUtil;
-import com.att.dmf.mr.backends.kafka.KafkaConsumerCache;
-import com.att.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;
-import com.att.dmf.mr.backends.kafka.KafkaLiveLockAvoider2;
-import com.att.dmf.mr.backends.kafka.LiveLockAvoidance;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.utils.ConfigurationReader;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.backends.kafka.Kafka011Consumer;
+import org.onap.dmaap.dmf.mr.backends.kafka.Kafka011ConsumerUtil;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaLiveLockAvoider2;
+import org.onap.dmaap.dmf.mr.backends.kafka.LiveLockAvoidance;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.util.Arrays;
import java.util.LinkedList;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metabroker.Broker;
-import com.att.dmf.mr.metabroker.Broker1;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.utils.ConfigurationReader;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metabroker.Broker;
+import org.onap.dmaap.dmf.mr.metabroker.Broker1;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.Utils;
//import org.apache.log4-j.Logger;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import com.att.dmf.mr.CambriaApiVersionInfo;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.mr.apiServer.metrics.cambria.DMaaPMetricsSender;
+import org.onap.dmaap.dmf.mr.CambriaApiVersionInfo;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.mr.apiServer.metrics.cambria.DMaaPMetricsSender;
import com.att.nsa.drumlin.till.nv.rrNvReadable;
import com.att.nsa.metrics.impl.CdmConstant;
import com.att.nsa.metrics.impl.CdmCounter;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.security.Key;
import org.springframework.beans.factory.annotation.Autowired;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDb;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import org.I0Itec.zkclient.ZkClient;
import org.springframework.beans.factory.annotation.Qualifier;
-import com.att.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
import com.att.nsa.drumlin.till.nv.rrNvReadable;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import org.springframework.beans.factory.annotation.Qualifier;
-import com.att.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
import com.att.nsa.configs.confimpl.ZkConfigDb;
import com.att.nsa.drumlin.till.nv.rrNvReadable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.util.Date;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.utils.Utils;
/**
* @author muzainulhaque.qazi
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.beans;
+package org.onap.dmaap.dmf.mr.beans;
import java.io.Serializable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.constants;
+package org.onap.dmaap.dmf.mr.constants;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.utils.Utils;
/**
* This is the constant files for all the property or parameters.
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
public class DMaaPAccessDeniedException extends CambriaApiException{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
import javax.annotation.PostConstruct;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
/**
* Define the Error Response Codes for MR
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
import javax.inject.Singleton;
import javax.ws.rs.BadRequestException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.exception;
+package org.onap.dmaap.dmf.mr.exception;
import org.json.JSONObject;
/**
* Represents the Error Response Object
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.listener;
+package org.onap.dmaap.dmf.mr.listener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.listener;
+package org.onap.dmaap.dmf.mr.listener;
import java.io.IOException;
import java.io.InputStream;
import com.att.aft.dme2.manager.registry.DME2EndpointRegistry;
import com.att.aft.dme2.api.DME2Exception;
import com.att.aft.dme2.api.DME2Manager;
-import com.att.dmf.mr.service.impl.EventsServiceImpl;
+import org.onap.dmaap.dmf.mr.service.impl.EventsServiceImpl;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metabroker;
+package org.onap.dmaap.dmf.mr.metabroker;
import java.util.List;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metabroker;
+package org.onap.dmaap.dmf.mr.metabroker;
import java.util.List;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metabroker;
+package org.onap.dmaap.dmf.mr.metabroker;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.NsaAcl;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
import java.io.IOException;
import java.util.List;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
import java.io.IOException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
import java.io.IOException;
import java.util.Collection;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher;
+package org.onap.dmaap.dmf.mr.metrics.publisher;
import java.net.MalformedURLException;
import java.nio.channels.NotYetConnectedException;
import java.util.TreeSet;
import java.util.UUID;
-import com.att.dmf.mr.metrics.publisher.impl.DMaaPCambriaConsumerImpl;
-import com.att.dmf.mr.metrics.publisher.impl.DMaaPCambriaSimplerBatchPublisher;
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.DMaaPCambriaConsumerImpl;
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.DMaaPCambriaSimplerBatchPublisher;
/**
* A factory for Cambria clients.<br/>
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher.impl;
+package org.onap.dmaap.dmf.mr.metrics.publisher.impl;
import java.net.MalformedURLException;
import java.util.Collection;
import org.json.JSONArray;
import org.json.JSONException;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
//import org.slf4j.LoggerFactory;
import com.att.eelf.configuration.EELFLogger;
* @author anowarul.islam
*
*/
-public class CambriaBaseClient extends HttpClient implements com.att.dmf.mr.metrics.publisher.CambriaClient
+public class CambriaBaseClient extends HttpClient implements org.onap.dmaap.dmf.mr.metrics.publisher.CambriaClient
{
protected CambriaBaseClient ( Collection<String> hosts ) throws MalformedURLException
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher.impl;
+package org.onap.dmaap.dmf.mr.metrics.publisher.impl;
/**
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher.impl;
+package org.onap.dmaap.dmf.mr.metrics.publisher.impl;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.json.JSONException;
import org.json.JSONObject;
-import com.att.dmf.mr.metrics.publisher.CambriaPublisherUtility;
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisherUtility;
import com.att.nsa.apiClient.http.HttpException;
import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
*
*/
public class DMaaPCambriaConsumerImpl extends CambriaBaseClient
- implements com.att.dmf.mr.metrics.publisher.CambriaConsumer {
+ implements org.onap.dmaap.dmf.mr.metrics.publisher.CambriaConsumer {
private final String fTopic;
private final String fGroup;
private final String fId;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.metrics.publisher.impl;
+package org.onap.dmaap.dmf.mr.metrics.publisher.impl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.ws.rs.core.Response;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metrics.publisher.CambriaPublisherUtility;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisherUtility;
/**
*
*
*/
public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
- implements com.att.dmf.mr.metrics.publisher.CambriaBatchingPublisher {
+ implements org.onap.dmaap.dmf.mr.metrics.publisher.CambriaBatchingPublisher {
/**
*
* static inner class initializes with urls, topic,batchSize
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources;
+package org.onap.dmaap.dmf.mr.resources;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.resources.streamReaders.CambriaJsonStreamReader;
-import com.att.dmf.mr.resources.streamReaders.CambriaRawStreamReader;
-import com.att.dmf.mr.resources.streamReaders.CambriaStreamReader;
-import com.att.dmf.mr.resources.streamReaders.CambriaTextStreamReader;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaJsonStreamReader;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaRawStreamReader;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaStreamReader;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaTextStreamReader;
import com.att.nsa.apiServer.streams.ChunkedInputStream;
import com.att.nsa.drumlin.service.standards.HttpStatusCodes;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources;
+package org.onap.dmaap.dmf.mr.resources;
import java.io.IOException;
import java.io.OutputStream;
import org.json.JSONTokener;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder.StreamWriter;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder.StreamWriter;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources.streamReaders;
+package org.onap.dmaap.dmf.mr.resources.streamReaders;
import java.io.InputStream;
import org.json.JSONObject;
import org.json.JSONTokener;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.resources.CambriaEventSet.reader;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet.reader;
/**
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources.streamReaders;
+package org.onap.dmaap.dmf.mr.resources.streamReaders;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.resources.CambriaEventSet.reader;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet.reader;
import com.att.nsa.util.StreamTools;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources.streamReaders;
+package org.onap.dmaap.dmf.mr.resources.streamReaders;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.resources.CambriaEventSet.reader;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet.reader;
/**
* Read an optionally chunked stream in the Cambria app format. This format
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.resources.streamReaders;
+package org.onap.dmaap.dmf.mr.resources.streamReaders;
import java.io.BufferedReader;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.resources.CambriaEventSet.reader;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet.reader;
/**
* This stream reader just pulls single lines. It uses the default partition if provided. If
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security;
+package org.onap.dmaap.dmf.mr.security;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security;
+package org.onap.dmaap.dmf.mr.security;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security;
+package org.onap.dmaap.dmf.mr.security;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.nsa.security.NsaApiKey;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security;
+package org.onap.dmaap.dmf.mr.security;
import java.util.LinkedList;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;
import com.att.nsa.security.NsaApiKey;
import com.att.nsa.security.db.NsaApiDb;
import com.att.nsa.security.db.simple.NsaSimpleApiKey;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security.impl;
+package org.onap.dmaap.dmf.mr.security.impl;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.security.impl;
+package org.onap.dmaap.dmf.mr.security.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import org.json.JSONException;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
-import com.att.dmf.mr.beans.ApiKeyBean;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
import com.att.nsa.security.db.NsaApiDb.KeyExistsException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import java.io.InputStream;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import java.io.InputStream;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
/**
* @author amol.ramesh.dalne
*/
import java.io.IOException;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
/**
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import org.json.JSONException;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.beans.TopicBean;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import com.att.aft.dme2.internal.jettison.json.JSONException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
import com.att.nsa.configs.ConfigDbException;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service;
+package org.onap.dmaap.dmf.mr.service;
import java.io.IOException;
import org.apache.kafka.common.errors.TopicExistsException;
import org.json.JSONException;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.nsa.configs.ConfigDbException;
/**
* @author muzainulhaque.qazi
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import java.util.Collection;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.ConsumerFactory;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
-import com.att.dmf.mr.service.AdminService;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.AdminService;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
-import com.att.dmf.mr.beans.ApiKeyBean;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
-import com.att.dmf.mr.service.ApiKeysService;
-import com.att.dmf.mr.utils.ConfigurationReader;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
-import com.att.dmf.mr.utils.Emailer;
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.ApiKeysService;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Emailer;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.util.Set;
import java.util.TreeSet;
-import com.att.dmf.mr.transaction.DMaaPTransactionFactory;
-import com.att.dmf.mr.transaction.DMaaPTransactionObj;
-import com.att.dmf.mr.transaction.DMaaPTransactionObjDB;
-import com.att.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionFactory;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObjDB;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
import com.att.nsa.configs.ConfigDb;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.configs.ConfigPath;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import java.io.InputStream;
import org.springframework.stereotype.Service;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.ConsumerFactory;
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.backends.Publisher;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.backends.kafka.KafkaLiveLockAvoider2;
-import com.att.dmf.mr.beans.DMaaPCambriaLimiter;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.exception.DMaaPAccessDeniedException;
-import com.att.dmf.mr.exception.DMaaPErrorMessages;
-import com.att.dmf.mr.exception.DMaaPResponseCode;
-import com.att.dmf.mr.exception.ErrorResponse;
-
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.resources.CambriaEventSet;
-import com.att.dmf.mr.resources.CambriaOutboundEventStream;
-import com.att.dmf.mr.security.DMaaPAAFAuthenticator;
-import com.att.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
-import com.att.dmf.mr.service.EventsService;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaLiveLockAvoider2;
+import org.onap.dmaap.dmf.mr.beans.DMaaPCambriaLimiter;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.exception.DMaaPResponseCode;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet;
+import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.EventsService;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.springframework.stereotype.Service;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.Consumer;
-import com.att.dmf.mr.backends.ConsumerFactory;
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.backends.Publisher;
-import com.att.dmf.mr.backends.Publisher.message;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.beans.LogDetails;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.exception.DMaaPErrorMessages;
-import com.att.dmf.mr.exception.DMaaPResponseCode;
-import com.att.dmf.mr.exception.ErrorResponse;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.resources.CambriaEventSet;
-import com.att.dmf.mr.resources.CambriaOutboundEventStream;
-import com.att.dmf.mr.service.MMService;
-import com.att.dmf.mr.utils.ConfigurationReader;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Consumer;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.exception.DMaaPResponseCode;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet;
+import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream;
+import org.onap.dmaap.dmf.mr.service.MMService;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.service.MetricsService;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.service.MetricsService;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.metrics.CdmMeasuredItem;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import org.springframework.stereotype.Service;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;
-import com.att.dmf.mr.beans.TopicBean;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.exception.DMaaPAccessDeniedException;
-import com.att.dmf.mr.exception.DMaaPErrorMessages;
-import com.att.dmf.mr.exception.DMaaPResponseCode;
-import com.att.dmf.mr.exception.ErrorResponse;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
-import com.att.dmf.mr.metabroker.Broker1;
-
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.security.DMaaPAAFAuthenticator;
-import com.att.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
-import com.att.dmf.mr.service.TopicService;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.exception.DMaaPResponseCode;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.metabroker.Broker1;
+
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.TopicService;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Utils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
DMaaPResponseCode.INCORRECT_JSON.getResponseCode(), errorMessages.getIncorrectJson());
LOGGER.info(errRes.toString());
throw new CambriaApiException(errRes);
- } catch (com.att.dmf.mr.metabroker.Broker1.TopicExistsException e) {
+ } catch (org.onap.dmaap.dmf.mr.metabroker.Broker1.TopicExistsException e) {
// TODO Auto-generated catch block
LOGGER.error( e.getMessage());
}
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import org.springframework.stereotype.Service;
import com.att.aft.dme2.internal.jettison.json.JSONException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.service.TransactionService;
-import com.att.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.service.TransactionService;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
import com.att.nsa.configs.ConfigDbException;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.service.impl;
+package org.onap.dmaap.dmf.mr.service.impl;
import java.io.IOException;
import java.util.LinkedList;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.service.UIService;
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.service.UIService;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction;
+package org.onap.dmaap.dmf.mr.transaction;
/**
*
* @author anowarul.islam
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction;
+package org.onap.dmaap.dmf.mr.transaction;
import org.json.JSONObject;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction;
+package org.onap.dmaap.dmf.mr.transaction;
import java.util.Set;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction;
+package org.onap.dmaap.dmf.mr.transaction;
import org.json.JSONObject;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction;
+package org.onap.dmaap.dmf.mr.transaction;
/**
* Created for transaction enable logging details, this is nothing but a bean
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.transaction.impl;
+package org.onap.dmaap.dmf.mr.transaction.impl;
import org.json.JSONObject;
-import com.att.dmf.mr.transaction.DMaaPTransactionFactory;
-import com.att.dmf.mr.transaction.DMaaPTransactionObj;
-import com.att.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionFactory;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
/**
* A factory for the simple Transaction implementation
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import javax.servlet.ServletException;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
-import com.att.dmf.mr.backends.ConsumerFactory;
-import com.att.dmf.mr.backends.MetricsSet;
-import com.att.dmf.mr.backends.Publisher;
-import com.att.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;
-import com.att.dmf.mr.backends.memory.MemoryConsumerFactory;
-import com.att.dmf.mr.backends.memory.MemoryMetaBroker;
-import com.att.dmf.mr.backends.memory.MemoryQueue;
-import com.att.dmf.mr.backends.memory.MemoryQueuePublisher;
-import com.att.dmf.mr.beans.DMaaPCambriaLimiter;
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;
-import com.att.dmf.mr.beans.DMaaPZkConfigDb;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metabroker.Broker;
-
-import com.att.dmf.mr.metabroker.Broker1;
-import com.att.dmf.mr.security.DMaaPAuthenticator;
-import com.att.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.backends.Publisher;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryMetaBroker;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryQueue;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryQueuePublisher;
+import org.onap.dmaap.dmf.mr.beans.DMaaPCambriaLimiter;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.beans.DMaaPZkConfigDb;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metabroker.Broker;
+
+import org.onap.dmaap.dmf.mr.metabroker.Broker1;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.configs.ConfigDbException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
import com.att.nsa.drumlin.till.nv.rrNvReadable;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import org.json.JSONException;
import org.json.JSONObject;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import java.io.IOException;
import java.util.Properties;
import com.att.ajsc.filemonitor.AJSCPropertiesMap;
-import com.att.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import java.util.Map;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.dmf.mr.utils;
+package org.onap.dmaap.dmf.mr.utils;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletRequest;
-import com.att.dmf.mr.backends.kafka.KafkaPublisher;
-import com.att.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaPublisher;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
/**
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.apiServer.metrics.cambria;
+package org.onap.dmaap.mr.apiServer.metrics.cambria;
import java.io.IOException;
import java.net.InetAddress;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metrics.publisher.CambriaPublisher;
-import com.att.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisher;
+import org.onap.dmaap.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.nsa.apiServer.metrics.cambria.MetricsSender;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.filter;
+package org.onap.dmaap.mr.filter;
import java.io.IOException;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.exception.DMaaPErrorMessages;
-import com.att.dmf.mr.exception.DMaaPResponseCode;
-import com.att.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.exception.DMaaPResponseCode;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.filter;
+package org.onap.dmaap.mr.filter;
public class DefaultLength {
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.apiServer.metrics.cambria;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security.impl;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction.impl;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+++ /dev/null
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-
-package com.att.sa.cambria.testClient;
-
-import kafka.api.FetchRequest;
-import kafka.api.FetchRequestBuilder;
-import kafka.api.PartitionOffsetRequestInfo;
-import kafka.cluster.Broker;
-import kafka.common.ErrorMapping;
-import kafka.common.TopicAndPartition;
-import kafka.javaapi.*;
-import kafka.javaapi.consumer.SimpleConsumer;
-import kafka.message.MessageAndOffset;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class SimpleExample
-{
-// public static void main ( String args[] )
-// {
-// if ( args.length < 5 )
-// {
-// System.err.println ( "usage: SimpleExample <maxReads> <topic> <partition> <host> <port>" );
-// return;
-// }
-//
-// final long maxReads = Long.parseLong ( args[0] );
-// final String topic = args[1];
-// final int partition = Integer.parseInt ( args[2] );
-//
-// final int port = Integer.parseInt ( args[4] );
-// final hostPort hp = new hostPort ( args[3], port );
-// final LinkedList<hostPort> seeds = new LinkedList<hostPort> ();
-// seeds.add ( hp );
-//
-// try
-// {
-// final SimpleExample example = new SimpleExample ();
-// example.run ( maxReads, topic, partition, seeds );
-// }
-// catch ( Exception e )
-// {
-// System.out.println ( "Oops:" + e );
-// e.printStackTrace ();
-// }
-// }
-//
-// public SimpleExample ()
-// {
-// fReplicaBrokers = new ArrayList<hostPort> ();
-// }
-//
-// public void run ( long remainingAllowedReads, String a_topic, int a_partition, List<hostPort> seedHosts ) throws IOException
-// {
-// // find the meta data about the topic and partition we are interested in
-//
-// hostPort leadBroker = findLeader ( seedHosts, a_topic, a_partition );
-// if ( leadBroker == null )
-// {
-// System.out.println ( "Can't find leader for Topic and Partition. Exiting" );
-// return;
-// }
-//
-// final String clientName = "Client_" + a_topic + "_" + a_partition;
-//
-// SimpleConsumer consumer = new SimpleConsumer ( leadBroker.fHost, leadBroker.fPort, 100000, 64 * 1024, clientName );
-// long readOffset = getLastOffset ( consumer, a_topic, a_partition, kafka.api.OffsetRequest.EarliestTime (), clientName );
-//
-// int numErrors = 0;
-// while ( remainingAllowedReads > 0 )
-// {
-// if ( consumer == null )
-// {
-// consumer = new SimpleConsumer ( leadBroker.fHost, leadBroker.fPort, 100000, 64 * 1024, clientName );
-// }
-//
-// final FetchRequest req = new FetchRequestBuilder ()
-// .clientId ( clientName )
-// .addFetch ( a_topic, a_partition, readOffset, 100000 ).build ();
-// final FetchResponse fetchResponse = consumer.fetch ( req );
-//
-// if ( fetchResponse.hasError () )
-// {
-// numErrors++;
-//
-// // Something went wrong!
-// final short code = fetchResponse.errorCode ( a_topic, a_partition );
-// System.out.println ( "Error fetching data from the Broker:" + leadBroker + " Reason: " + code );
-// if ( numErrors > 5 )
-// break;
-//
-// if ( code == ErrorMapping.OffsetOutOfRangeCode () )
-// {
-// // We asked for an invalid offset. For simple case ask for
-// // the last element to reset
-// readOffset = getLastOffset ( consumer, a_topic,
-// a_partition, kafka.api.OffsetRequest.LatestTime (),
-// clientName );
-// continue;
-// }
-//
-// consumer.close ();
-// consumer = null;
-//
-// leadBroker = findNewLeader ( leadBroker, a_topic, a_partition );
-// continue;
-// }
-// numErrors = 0;
-//
-// long numRead = 0;
-// for ( MessageAndOffset messageAndOffset : fetchResponse.messageSet ( a_topic, a_partition ) )
-// {
-// long currentOffset = messageAndOffset.offset ();
-// if ( currentOffset < readOffset )
-// {
-// System.out.println ( "Found an old offset: "
-// + currentOffset + " Expecting: " + readOffset );
-// continue;
-// }
-// readOffset = messageAndOffset.nextOffset ();
-// ByteBuffer payload = messageAndOffset.message ().payload ();
-//
-// byte[] bytes = new byte [payload.limit ()];
-// payload.get ( bytes );
-// System.out.println ( String.valueOf ( messageAndOffset.offset () ) + ": " + new String ( bytes, "UTF-8" ) );
-// numRead++;
-// remainingAllowedReads--;
-// }
-//
-// if ( numRead == 0 )
-// {
-// try
-// {
-// Thread.sleep ( 1000 );
-// }
-// catch ( InterruptedException ie )
-// {
-// }
-// }
-// }
-//
-// if ( consumer != null )
-// {
-// consumer.close ();
-// }
-// }
-//
-// public static long getLastOffset ( SimpleConsumer consumer, String topic,
-// int partition, long whichTime, String clientName )
-// {
-// TopicAndPartition topicAndPartition = new TopicAndPartition ( topic,
-// partition );
-// Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo> ();
-// requestInfo.put ( topicAndPartition, new PartitionOffsetRequestInfo (
-// whichTime, 1 ) );
-// kafka.javaapi.OffsetRequest request = new kafka.javaapi.OffsetRequest (
-// requestInfo, kafka.api.OffsetRequest.CurrentVersion (), clientName );
-// OffsetResponse response = consumer.getOffsetsBefore ( request );
-//
-// if ( response.hasError () )
-// {
-// System.out.println ( "Error fetching data Offset Data the Broker. Reason: "
-// + response.errorCode ( topic, partition ) );
-// return 0;
-// }
-//
-// final long[] offsets = response.offsets ( topic, partition );
-// return offsets[0];
-// }
-//
-// /**
-// * Find a new leader for a topic/partition, including a pause for the coordinator to
-// * find a new leader, as needed.
-// *
-// * @param oldLeader
-// * @param topic
-// * @param partition
-// * @return
-// * @throws IOException
-// */
-// private hostPort findNewLeader ( hostPort oldLeader, String topic, int partition ) throws IOException
-// {
-// try
-// {
-// int attemptsLeft = 3;
-// boolean haveSlept = false;
-//
-// while ( attemptsLeft-- > 0 )
-// {
-// System.out.println ( "" + attemptsLeft + " attempts Left" ); // FIXME: make sure it's 3 attempts!
-//
-// // ask the brokers for a leader
-// final hostPort newLeader = findLeader ( fReplicaBrokers, topic, partition );
-// if ( newLeader != null )
-// {
-// // we can use this leader if it's different (i.e. a new leader has been elected)
-// // or it's the same leader, but we waited to allow ZK to get a new one, and
-// // the original recovered
-// if ( !oldLeader.equals ( newLeader ) || haveSlept )
-// {
-// return newLeader;
-// }
-// }
-//
-// // sleep
-// haveSlept = true;
-// Thread.sleep ( 1000 );
-// }
-// }
-// catch ( InterruptedException x )
-// {
-// // just give up
-// }
-//
-// System.out.println ( "Unable to find new leader after Broker failure. Exiting" );
-// throw new IOException ( "Unable to find new leader after Broker failure. Exiting" );
-// }
-//
-// /**
-// * Given one or more seed brokers, find the leader for a given topic/partition
-// * @param seeds
-// * @param topic
-// * @param partition
-// * @return partition metadata, or null
-// */
-// private hostPort findLeader ( List<hostPort> seeds, String topic, int partition )
-// {
-// final List<String> topics = new ArrayList<String> ();
-// topics.add ( topic );
-//
-// for ( hostPort seed : seeds )
-// {
-// final SimpleConsumer consumer = new SimpleConsumer ( seed.fHost, seed.fPort, 100000, 64 * 1024, "leaderLookup" );
-// final TopicMetadataRequest req = new TopicMetadataRequest ( topics );
-// final TopicMetadataResponse resp = consumer.send ( req );
-// consumer.close ();
-//
-// final List<TopicMetadata> metaData = resp.topicsMetadata ();
-// for ( TopicMetadata item : metaData )
-// {
-// for ( PartitionMetadata part : item.partitionsMetadata () )
-// {
-// if ( part.partitionId () == partition )
-// {
-// // found our partition. load the details, then return it
-// fReplicaBrokers.clear ();
-// for ( kafka.cluster.Broker replica : part.replicas () )
-// {
-// fReplicaBrokers.add ( new hostPort ( replica.host (), replica.port () ) );
-// }
-// return new hostPort ( part.leader () );
-// }
-// }
-// }
-// }
-//
-// return null;
-// }
-//
-// private static class hostPort
-// {
-// public hostPort ( String host, int port ) { fHost = host; fPort = port; }
-//
-// public hostPort ( Broker leader )
-// {
-// fHost = leader.host ();
-// fPort = leader.port ();
-// }
-//
-//
-// public final String fHost;
-// public final int fPort;
-//
-// @Override
-// public int hashCode ()
-// {
-// final int prime = 31;
-// int result = 1;
-// result = prime * result
-// + ( ( fHost == null ) ? 0 : fHost.hashCode () );
-// result = prime * result + fPort;
-// return result;
-// }
-//
-// @Override
-// public boolean equals ( Object obj )
-// {
-// if ( this == obj )
-// return true;
-// if ( obj == null )
-// return false;
-// if ( getClass () != obj.getClass () )
-// return false;
-// hostPort other = (hostPort) obj;
-// if ( fHost == null )
-// {
-// if ( other.fHost != null )
-// return false;
-// }
-// else if ( !fHost.equals ( other.fHost ) )
-// return false;
-// if ( fPort != other.fPort )
-// return false;
-// return true;
-// }
-// }
-//
-// private List<hostPort> fReplicaBrokers;
-}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.apiServer.metrics.cambria;\r
-\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.File;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.mr.apiServer.metrics.cambria.DMaaPMetricsSender;\r
-\r
-public class DMaaPMetricsSenderTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- ClassLoader classLoader = getClass().getClassLoader(); \r
- AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- @Test\r
- public void testSendPeriodically() {\r
- \r
- DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");\r
- try {\r
- sender.sendPeriodically(null, null, "testTopic");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (NoClassDefFoundError e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSendPeriodically2() {\r
- \r
- DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");\r
- try {\r
- sender.sendPeriodically(null, null, "url", "testTopic", 2);\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSend() {\r
- \r
- DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");\r
- try {\r
- sender.send();\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testRun() {\r
- \r
- DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");\r
- try {\r
- sender.run();\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.apiServer.metrics.cambria;
+
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.mr.apiServer.metrics.cambria.DMaaPMetricsSender;
+
+public class DMaaPMetricsSenderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+ AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSendPeriodically() {
+
+ DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
+ try {
+ sender.sendPeriodically(null, null, "testTopic");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (NoClassDefFoundError e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSendPeriodically2() {
+
+ DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
+ try {
+ sender.sendPeriodically(null, null, "url", "testTopic", 2);
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSend() {
+
+ DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
+ try {
+ sender.send();
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testRun() {
+
+ DMaaPMetricsSender sender = new DMaaPMetricsSender(null, "url", "testTopic");
+ try {
+ sender.run();
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.apiServer.metrics.cambria;\r
-\r
-import junit.framework.TestSuite;\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPMetricsSenderTest.class})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.apiServer.metrics.cambria;
+
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPMetricsSenderTest.class})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.filter;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.apiServer.metrics.cambria;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.exception.ErrorResponse;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class CambriaApiExceptionTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetErrRes() {\r
- \r
- int status = 1;\r
- String msg = "helloWorld";\r
- CambriaApiException cambria = new CambriaApiException(status, msg);\r
- \r
- cambria.getErrRes();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSetErrRes() {\r
- \r
- int status = 1;\r
- String msg = "helloWorld";\r
- CambriaApiException cambria = new CambriaApiException(status, msg);\r
- \r
- cambria.setErrRes(new ErrorResponse(200, 0, "OK"));\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.cambria;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CambriaApiExceptionTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetErrRes() {
+
+ int status = 1;
+ String msg = "helloWorld";
+ CambriaApiException cambria = new CambriaApiException(status, msg);
+
+ cambria.getErrRes();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSetErrRes() {
+
+ int status = 1;
+ String msg = "helloWorld";
+ CambriaApiException cambria = new CambriaApiException(status, msg);
+
+ cambria.setErrRes(new ErrorResponse(200, 0, "OK"));
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.cambria;
+package org.onap.dmaap.mr.cambria;
import java.util.HashMap;
import java.util.Map;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.CambriaApiVersionInfo;\r
-import com.att.dmf.mr.exception.ErrorResponse;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class CambriaApiVersionInfoTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetVersion() {\r
- CambriaApiVersionInfo.getVersion();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.cambria;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.CambriaApiVersionInfo;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CambriaApiVersionInfoTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetVersion() {
+ CambriaApiVersionInfo.getVersion();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+
+}
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.cambria;
+package org.onap.dmaap.mr.cambria;
import junit.framework.TestCase;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ CambriaApiExceptionTest.class, CambriaApiVersionInfoTest.class, CambriaApiTestCase.class, CambriaRateLimiterTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.cambria;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ CambriaApiExceptionTest.class, CambriaApiVersionInfoTest.class, CambriaApiTestCase.class, CambriaRateLimiterTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.cambria;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.apache.curator.CuratorZookeeperClient;\r
-import org.apache.curator.framework.CuratorFramework;\r
-import org.apache.curator.framework.WatcherRemoveCuratorFramework;\r
-import org.apache.curator.framework.api.CreateBuilder;\r
-import org.apache.curator.framework.api.CuratorListener;\r
-import org.apache.curator.framework.api.DeleteBuilder;\r
-import org.apache.curator.framework.api.ExistsBuilder;\r
-import org.apache.curator.framework.api.GetACLBuilder;\r
-import org.apache.curator.framework.api.GetChildrenBuilder;\r
-import org.apache.curator.framework.api.GetConfigBuilder;\r
-import org.apache.curator.framework.api.GetDataBuilder;\r
-import org.apache.curator.framework.api.ReconfigBuilder;\r
-import org.apache.curator.framework.api.RemoveWatchesBuilder;\r
-import org.apache.curator.framework.api.SetACLBuilder;\r
-import org.apache.curator.framework.api.SetDataBuilder;\r
-import org.apache.curator.framework.api.SyncBuilder;\r
-import org.apache.curator.framework.api.UnhandledErrorListener;\r
-import org.apache.curator.framework.api.transaction.CuratorMultiTransaction;\r
-import org.apache.curator.framework.api.transaction.CuratorTransaction;\r
-import org.apache.curator.framework.api.transaction.TransactionOp;\r
-import org.apache.curator.framework.imps.CuratorFrameworkState;\r
-import org.apache.curator.framework.listen.Listenable;\r
-import org.apache.curator.framework.schema.SchemaSet;\r
-import org.apache.curator.framework.state.ConnectionStateErrorPolicy;\r
-import org.apache.curator.framework.state.ConnectionStateListener;\r
-import org.apache.curator.utils.EnsurePath;\r
-import org.apache.zookeeper.Watcher;\r
-import org.apache.zookeeper.server.quorum.flexible.QuorumVerifier;\r
-\r
-public class CuratorFrameworkImpl implements CuratorFramework {\r
-\r
- @Override\r
- public void blockUntilConnected() throws InterruptedException {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public boolean blockUntilConnected(int arg0, TimeUnit arg1) throws InterruptedException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public ExistsBuilder checkExists() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void clearWatcherReferences(Watcher arg0) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void close() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public CreateBuilder create() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public DeleteBuilder delete() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public GetACLBuilder getACL() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public GetChildrenBuilder getChildren() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Listenable<ConnectionStateListener> getConnectionStateListenable() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Listenable<CuratorListener> getCuratorListenable() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public GetDataBuilder getData() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public String getNamespace() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CuratorFrameworkState getState() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Listenable<UnhandledErrorListener> getUnhandledErrorListenable() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CuratorZookeeperClient getZookeeperClient() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CuratorTransaction inTransaction() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public boolean isStarted() {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public EnsurePath newNamespaceAwareEnsurePath(String arg0) {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CuratorFramework nonNamespaceView() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public SetACLBuilder setACL() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public SetDataBuilder setData() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void start() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public SyncBuilder sync() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void sync(String arg0, Object arg1) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public CuratorFramework usingNamespace(String arg0) {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public ReconfigBuilder reconfig() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public GetConfigBuilder getConfig() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CuratorMultiTransaction transaction() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public TransactionOp transactionOp() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void createContainers(String path) throws Exception {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public RemoveWatchesBuilder watches() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public WatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public ConnectionStateErrorPolicy getConnectionStateErrorPolicy() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public QuorumVerifier getCurrentConfig() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public SchemaSet getSchemaSet() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public boolean isZk34CompatibilityMode() {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.curator.CuratorZookeeperClient;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.WatcherRemoveCuratorFramework;
+import org.apache.curator.framework.api.CreateBuilder;
+import org.apache.curator.framework.api.CuratorListener;
+import org.apache.curator.framework.api.DeleteBuilder;
+import org.apache.curator.framework.api.ExistsBuilder;
+import org.apache.curator.framework.api.GetACLBuilder;
+import org.apache.curator.framework.api.GetChildrenBuilder;
+import org.apache.curator.framework.api.GetConfigBuilder;
+import org.apache.curator.framework.api.GetDataBuilder;
+import org.apache.curator.framework.api.ReconfigBuilder;
+import org.apache.curator.framework.api.RemoveWatchesBuilder;
+import org.apache.curator.framework.api.SetACLBuilder;
+import org.apache.curator.framework.api.SetDataBuilder;
+import org.apache.curator.framework.api.SyncBuilder;
+import org.apache.curator.framework.api.UnhandledErrorListener;
+import org.apache.curator.framework.api.transaction.CuratorMultiTransaction;
+import org.apache.curator.framework.api.transaction.CuratorTransaction;
+import org.apache.curator.framework.api.transaction.TransactionOp;
+import org.apache.curator.framework.imps.CuratorFrameworkState;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.schema.SchemaSet;
+import org.apache.curator.framework.state.ConnectionStateErrorPolicy;
+import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.EnsurePath;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.server.quorum.flexible.QuorumVerifier;
+
+public class CuratorFrameworkImpl implements CuratorFramework {
+
+ @Override
+ public void blockUntilConnected() throws InterruptedException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean blockUntilConnected(int arg0, TimeUnit arg1) throws InterruptedException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public ExistsBuilder checkExists() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void clearWatcherReferences(Watcher arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public CreateBuilder create() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public DeleteBuilder delete() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public GetACLBuilder getACL() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public GetChildrenBuilder getChildren() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Listenable<ConnectionStateListener> getConnectionStateListenable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Listenable<CuratorListener> getCuratorListenable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public GetDataBuilder getData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNamespace() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CuratorFrameworkState getState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Listenable<UnhandledErrorListener> getUnhandledErrorListenable() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CuratorZookeeperClient getZookeeperClient() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CuratorTransaction inTransaction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isStarted() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public EnsurePath newNamespaceAwareEnsurePath(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CuratorFramework nonNamespaceView() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SetACLBuilder setACL() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SetDataBuilder setData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void start() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public SyncBuilder sync() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void sync(String arg0, Object arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public CuratorFramework usingNamespace(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ReconfigBuilder reconfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public GetConfigBuilder getConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CuratorMultiTransaction transaction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public TransactionOp transactionOp() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void createContainers(String path) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RemoveWatchesBuilder watches() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public WatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ConnectionStateErrorPolicy getConnectionStateErrorPolicy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public QuorumVerifier getCurrentConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SchemaSet getSchemaSet() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isZk34CompatibilityMode() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ KafkaConsumerCacheTest.class, KafkaPublisherTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ KafkaConsumerCacheTest.class, KafkaPublisherTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.util.concurrent.ConcurrentHashMap;\r
-\r
-import org.apache.curator.framework.CuratorFramework;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-\r
-import com.att.dmf.mr.backends.MetricsSet;\r
-import com.att.dmf.mr.backends.kafka.Kafka011Consumer;\r
-import com.att.dmf.mr.backends.kafka.KafkaConsumerCache;\r
-import com.att.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ AJSCPropertiesMap.class })\r
-public class KafkaConsumerCacheTest {\r
- private KafkaConsumerCache kafkaConsumerCache =null;\r
- @Mock\r
- private ConcurrentHashMap<String, Kafka011Consumer> fConsumers;\r
- @Mock\r
- private MetricsSet fMetrics;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
-\r
- @Test\r
- public void testSweep() {\r
- kafkaConsumerCache = new KafkaConsumerCache();\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "kSetting_TouchEveryMs")).thenReturn("100");\r
- kafkaConsumerCache.sweep();\r
-\r
- }\r
- \r
-\r
- // DOES NOT WORK\r
- @Test\r
- public void testStartCache() {\r
-\r
- /*\r
- * KafkaConsumerCache kafka = null;\r
- * \r
- * try { kafka = new KafkaConsumerCache("123", null);\r
- * \r
- * } catch (NoClassDefFoundError e) { try { kafka.startCache("DMAAP",\r
- * null); } catch (NullPointerException e1) { // TODO Auto-generated\r
- * catch block assertTrue(true); } catch (KafkaConsumerCacheException\r
- * e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }\r
- */\r
-\r
- \r
- new CuratorFrameworkImpl();\r
- new MetricsSetImpl();\r
- KafkaConsumerCache kafka=null;\r
- try {\r
- kafka = new KafkaConsumerCache();\r
- kafka.setfApiId("1");\r
- kafka.startCache("DMAAP", null);\r
- } catch (NoClassDefFoundError e) {\r
-\r
- } catch (KafkaConsumerCacheException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testGetCuratorFramework() {\r
-\r
- CuratorFramework curator = new CuratorFrameworkImpl();\r
- new MetricsSetImpl();\r
- try {\r
-\r
- } catch (NoClassDefFoundError e) {\r
-\r
- KafkaConsumerCache.getCuratorFramework(curator);\r
- }\r
-\r
- }\r
-\r
- /*\r
- * @Test public void testStopCache() {\r
- * \r
- * KafkaConsumerCache kafka = null; new CuratorFrameworkImpl(); new\r
- * MetricsSetImpl(); try { kafka = new KafkaConsumerCache("123", null);\r
- * kafka.stopCache(); } catch (NoClassDefFoundError e) {\r
- * \r
- * }\r
- * \r
- * }\r
- */\r
-\r
- @Test\r
- public void testGetConsumerFor() {\r
-\r
- KafkaConsumerCache kafka = null;\r
-\r
- try {\r
- kafka = new KafkaConsumerCache();\r
- kafka.getConsumerFor("testTopic", "CG1", "23");\r
- } catch (NoClassDefFoundError e) {\r
-\r
- } catch (KafkaConsumerCacheException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testPutConsumerFor() {\r
-\r
- Kafka011Consumer consumer = null;\r
- KafkaConsumerCache kafka = null;\r
-\r
- try {\r
- kafka = new KafkaConsumerCache();\r
-\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.putConsumerFor("testTopic", "CG1", "23", consumer);\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } catch (KafkaConsumerCacheException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- }\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testGetConsumers() {\r
-\r
- KafkaConsumerCache kafka = null;\r
-\r
- try {\r
- kafka = new KafkaConsumerCache();\r
-\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.getConsumers();\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testDropAllConsumers() {\r
-\r
- KafkaConsumerCache kafka = null;\r
- try {\r
- kafka = new KafkaConsumerCache();\r
-\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.dropAllConsumers();\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testSignalOwnership() {\r
-\r
- KafkaConsumerCache kafka = null;\r
-\r
- try {\r
- kafka = new KafkaConsumerCache();\r
- // kafka.signalOwnership("testTopic", "CG1", "23");\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.signalOwnership("testTopic", "CG1", "23");\r
- } catch (KafkaConsumerCacheException e1) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- // assertTrue(true);\r
- e1.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- // assertTrue(true);\r
- }\r
-\r
- @Test\r
- public void testDropConsumer() {\r
-\r
- KafkaConsumerCache kafka = null;\r
-\r
- try {\r
- kafka = new KafkaConsumerCache();\r
- // kafka.dropConsumer("testTopic", "CG1", "23");\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.dropConsumer("testTopic", "CG1", "23");\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- }\r
-\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import org.onap.dmaap.dmf.mr.backends.kafka.Kafka011Consumer;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaConsumerCache.KafkaConsumerCacheException;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AJSCPropertiesMap.class })
+public class KafkaConsumerCacheTest {
+ private KafkaConsumerCache kafkaConsumerCache =null;
+ @Mock
+ private ConcurrentHashMap<String, Kafka011Consumer> fConsumers;
+ @Mock
+ private MetricsSet fMetrics;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testSweep() {
+ kafkaConsumerCache = new KafkaConsumerCache();
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "kSetting_TouchEveryMs")).thenReturn("100");
+ kafkaConsumerCache.sweep();
+
+ }
+
+
+ // DOES NOT WORK
+ @Test
+ public void testStartCache() {
+
+ /*
+ * KafkaConsumerCache kafka = null;
+ *
+ * try { kafka = new KafkaConsumerCache("123", null);
+ *
+ * } catch (NoClassDefFoundError e) { try { kafka.startCache("DMAAP",
+ * null); } catch (NullPointerException e1) { // TODO Auto-generated
+ * catch block assertTrue(true); } catch (KafkaConsumerCacheException
+ * e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
+ */
+
+
+ new CuratorFrameworkImpl();
+ new MetricsSetImpl();
+ KafkaConsumerCache kafka=null;
+ try {
+ kafka = new KafkaConsumerCache();
+ kafka.setfApiId("1");
+ kafka.startCache("DMAAP", null);
+ } catch (NoClassDefFoundError e) {
+
+ } catch (KafkaConsumerCacheException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testGetCuratorFramework() {
+
+ CuratorFramework curator = new CuratorFrameworkImpl();
+ new MetricsSetImpl();
+ try {
+
+ } catch (NoClassDefFoundError e) {
+
+ KafkaConsumerCache.getCuratorFramework(curator);
+ }
+
+ }
+
+ /*
+ * @Test public void testStopCache() {
+ *
+ * KafkaConsumerCache kafka = null; new CuratorFrameworkImpl(); new
+ * MetricsSetImpl(); try { kafka = new KafkaConsumerCache("123", null);
+ * kafka.stopCache(); } catch (NoClassDefFoundError e) {
+ *
+ * }
+ *
+ * }
+ */
+
+ @Test
+ public void testGetConsumerFor() {
+
+ KafkaConsumerCache kafka = null;
+
+ try {
+ kafka = new KafkaConsumerCache();
+ kafka.getConsumerFor("testTopic", "CG1", "23");
+ } catch (NoClassDefFoundError e) {
+
+ } catch (KafkaConsumerCacheException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testPutConsumerFor() {
+
+ Kafka011Consumer consumer = null;
+ KafkaConsumerCache kafka = null;
+
+ try {
+ kafka = new KafkaConsumerCache();
+
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.putConsumerFor("testTopic", "CG1", "23", consumer);
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ } catch (KafkaConsumerCacheException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ }
+
+ @Test
+ public void testGetConsumers() {
+
+ KafkaConsumerCache kafka = null;
+
+ try {
+ kafka = new KafkaConsumerCache();
+
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.getConsumers();
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+ }
+
+ }
+
+ @Test
+ public void testDropAllConsumers() {
+
+ KafkaConsumerCache kafka = null;
+ try {
+ kafka = new KafkaConsumerCache();
+
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.dropAllConsumers();
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+ }
+
+ }
+
+ @Test
+ public void testSignalOwnership() {
+
+ KafkaConsumerCache kafka = null;
+
+ try {
+ kafka = new KafkaConsumerCache();
+ // kafka.signalOwnership("testTopic", "CG1", "23");
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.signalOwnership("testTopic", "CG1", "23");
+ } catch (KafkaConsumerCacheException e1) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ // assertTrue(true);
+ e1.printStackTrace();
+ }
+
+ }
+
+ // assertTrue(true);
+ }
+
+ @Test
+ public void testDropConsumer() {
+
+ KafkaConsumerCache kafka = null;
+
+ try {
+ kafka = new KafkaConsumerCache();
+ // kafka.dropConsumer("testTopic", "CG1", "23");
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.dropConsumer("testTopic", "CG1", "23");
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+ }
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.ClassRule;\r
-import org.junit.Test;\r
-\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;\r
-\r
-import kafka.common.FailedToSendMessageException;\r
-import kafka.producer.KeyedMessage;\r
-\r
-public class KafkaPublisherTest {\r
- \r
- \r
-\r
- /*@Before\r
- public void setUp() throws Exception {\r
- ClassLoader classLoader = getClass().getClassLoader(); \r
- AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSendMessages() {\r
-\r
- String topic = "testTopic";\r
-\r
- KafkaPublisher kafka = null;\r
- try {\r
- kafka = new KafkaPublisher(null);\r
- \r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.sendMessage(topic, null);\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } catch (FailedToSendMessageException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- }\r
- } catch (FailedToSendMessageException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testSendBatchMessage() {\r
-\r
- String topic = "testTopic";\r
-\r
- KafkaPublisher kafka = null;\r
- ArrayList<KeyedMessage<String, String>> kms = null;\r
- try {\r
- kafka = new KafkaPublisher(null);\r
- \r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.sendBatchMessage(topic, kms);\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- }\r
- } catch (FailedToSendMessageException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
- \r
- @Test\r
- public void sendMessages() {\r
-\r
- String topic = "testTopic";\r
- \r
- List<message> msgs = null;\r
-\r
- KafkaPublisher kafka = null;\r
- //ArrayList<KeyedMessage<String, String>> kms = null;\r
- try {\r
- kafka = new KafkaPublisher(null);\r
- \r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NoClassDefFoundError e) {\r
- try {\r
- kafka.sendMessages(topic, msgs);\r
- } catch (NullPointerException e1) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } catch (FailedToSendMessageException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- }\r
- } catch (FailedToSendMessageException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }*/\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+
+import kafka.common.FailedToSendMessageException;
+import kafka.producer.KeyedMessage;
+
+public class KafkaPublisherTest {
+
+
+
+ /*@Before
+ public void setUp() throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+ AJSCPropertiesMap.refresh(new File(classLoader.getResource("MsgRtrApi.properties").getFile()));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSendMessages() {
+
+ String topic = "testTopic";
+
+ KafkaPublisher kafka = null;
+ try {
+ kafka = new KafkaPublisher(null);
+
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.sendMessage(topic, null);
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ } catch (FailedToSendMessageException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ } catch (FailedToSendMessageException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testSendBatchMessage() {
+
+ String topic = "testTopic";
+
+ KafkaPublisher kafka = null;
+ ArrayList<KeyedMessage<String, String>> kms = null;
+ try {
+ kafka = new KafkaPublisher(null);
+
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.sendBatchMessage(topic, kms);
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ } catch (FailedToSendMessageException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void sendMessages() {
+
+ String topic = "testTopic";
+
+ List<message> msgs = null;
+
+ KafkaPublisher kafka = null;
+ //ArrayList<KeyedMessage<String, String>> kms = null;
+ try {
+ kafka = new KafkaPublisher(null);
+
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoClassDefFoundError e) {
+ try {
+ kafka.sendMessages(topic, msgs);
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ } catch (FailedToSendMessageException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ } catch (FailedToSendMessageException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }*/
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.kafka;\r
-\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.json.JSONObject;\r
-\r
-import com.att.dmf.mr.backends.MetricsSet;\r
-import com.att.nsa.metrics.CdmMeasuredItem;\r
-\r
-public class MetricsSetImpl implements MetricsSet {\r
-\r
- @Override\r
- public List<? extends CdmMetricEntry> getEntries() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public CdmMeasuredItem getItem(String arg0) {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Map<String, CdmMeasuredItem> getItems() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void putItem(String arg0, CdmMeasuredItem arg1) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void removeItem(String arg0) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public int size() {\r
- // TODO Auto-generated method stub\r
- return 0;\r
- }\r
-\r
- @Override\r
- public JSONObject toJson() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public void setupCambriaSender() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void onRouteComplete(String name, long durationMs) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void publishTick(int amount) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void consumeTick(int amount) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void onKafkaConsumerCacheMiss() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void onKafkaConsumerCacheHit() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void onKafkaConsumerClaimed() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public void onKafkaConsumerTimeout() {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import java.util.List;
+import java.util.Map;
+
+import org.json.JSONObject;
+
+import org.onap.dmaap.dmf.mr.backends.MetricsSet;
+import com.att.nsa.metrics.CdmMeasuredItem;
+
+public class MetricsSetImpl implements MetricsSet {
+
+ @Override
+ public List<? extends CdmMetricEntry> getEntries() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CdmMeasuredItem getItem(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, CdmMeasuredItem> getItems() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void putItem(String arg0, CdmMeasuredItem arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeItem(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int size() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public JSONObject toJson() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setupCambriaSender() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onRouteComplete(String name, long durationMs) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void publishTick(int amount) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void consumeTick(int amount) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onKafkaConsumerCacheMiss() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onKafkaConsumerCacheHit() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onKafkaConsumerClaimed() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onKafkaConsumerTimeout() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.kafka;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ MemoryConsumerFactoryTest.class, MemoryMetaBrokerTest.class, MemoryQueueTest.class, \r
- MemoryQueuePublisherTest.class, MessageLoggerTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ MemoryConsumerFactoryTest.class, MemoryMetaBrokerTest.class, MemoryQueueTest.class,
+ MemoryQueuePublisherTest.class, MessageLoggerTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.backends.memory.MemoryConsumerFactory;\r
-\r
-public class MemoryConsumerFactoryTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetConsumerFor() {\r
- MemoryConsumerFactory factory = new MemoryConsumerFactory(null);\r
- \r
- \r
- String topic = "testTopic";\r
- String consumerGroupId = "CG1";\r
- String clientId = "C1";\r
- String remoteHost="remoteHost";\r
- int timeoutMs = 1000; \r
- factory.getConsumerFor(topic, consumerGroupId, clientId, timeoutMs,remoteHost);\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testDropCache() {\r
- MemoryConsumerFactory factory = new MemoryConsumerFactory(null);\r
- \r
- factory.dropCache();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGetConsumers() {\r
- MemoryConsumerFactory factory = new MemoryConsumerFactory(null);\r
- \r
- factory.getConsumers();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryConsumerFactory;
+
+public class MemoryConsumerFactoryTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetConsumerFor() {
+ MemoryConsumerFactory factory = new MemoryConsumerFactory(null);
+
+
+ String topic = "testTopic";
+ String consumerGroupId = "CG1";
+ String clientId = "C1";
+ String remoteHost="remoteHost";
+ int timeoutMs = 1000;
+ factory.getConsumerFor(topic, consumerGroupId, clientId, timeoutMs,remoteHost);
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testDropCache() {
+ MemoryConsumerFactory factory = new MemoryConsumerFactory(null);
+
+ factory.dropCache();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetConsumers() {
+ MemoryConsumerFactory factory = new MemoryConsumerFactory(null);
+
+ factory.getConsumers();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.backends.memory.MemoryMetaBroker;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-\r
-public class MemoryMetaBrokerTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetAllTopics() {\r
- MemoryMetaBroker broker = new MemoryMetaBroker(null, null);\r
- \r
- broker.getAllTopics();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGeTopic() {\r
- MemoryMetaBroker broker = new MemoryMetaBroker(null, null);\r
- \r
- broker.getTopic("testTopic");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateTopic() {\r
- \r
- //uncommenting this gives a Null Pointer Exception \r
- \r
- MemoryMetaBroker broker = new MemoryMetaBroker(null, null);\r
- \r
- int timeoutMs = 1000; \r
- try {\r
- broker.createTopic("testTopic","topic for testing", "ABCD123", 1,3, true);\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryMetaBroker;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+
+public class MemoryMetaBrokerTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetAllTopics() {
+ MemoryMetaBroker broker = new MemoryMetaBroker(null, null);
+
+ broker.getAllTopics();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGeTopic() {
+ MemoryMetaBroker broker = new MemoryMetaBroker(null, null);
+
+ broker.getTopic("testTopic");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testCreateTopic() {
+
+ //uncommenting this gives a Null Pointer Exception
+
+ MemoryMetaBroker broker = new MemoryMetaBroker(null, null);
+
+ int timeoutMs = 1000;
+ try {
+ broker.createTopic("testTopic","topic for testing", "ABCD123", 1,3, true);
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.backends.memory.MemoryQueuePublisher;\r
-\r
-\r
-public class MemoryQueuePublisherTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSendBatchMessage() {\r
- MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);\r
- \r
- try {\r
- publisher.sendBatchMessageNew("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSendMessage() {\r
- MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);\r
-\r
- try {\r
- publisher.sendMessage("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSendMessages() {\r
- MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);\r
- \r
-\r
- try {\r
- publisher.sendMessages("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryQueuePublisher;
+
+
+public class MemoryQueuePublisherTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSendBatchMessage() {
+ MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);
+
+ try {
+ publisher.sendBatchMessageNew("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSendMessage() {
+ MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);
+
+ try {
+ publisher.sendMessage("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSendMessages() {
+ MemoryQueuePublisher publisher = new MemoryQueuePublisher(null, null);
+
+
+ try {
+ publisher.sendMessages("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.backends.memory.MemoryQueue;\r
-\r
-\r
-public class MemoryQueueTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testCreateTopic() {\r
- MemoryQueue queue = new MemoryQueue();\r
- \r
- queue.createTopic("testTopic");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- @Test\r
- public void testRemoveTopic() {\r
- MemoryQueue queue = new MemoryQueue();\r
- \r
- queue.removeTopic("testTopic");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testPut() {\r
- MemoryQueue queue = new MemoryQueue();\r
- \r
- try {\r
- queue.put("testTopic", null);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGet() {\r
- MemoryQueue queue = new MemoryQueue();\r
- \r
- queue.get("testTopic", "consumer");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryQueue;
+
+
+public class MemoryQueueTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testCreateTopic() {
+ MemoryQueue queue = new MemoryQueue();
+
+ queue.createTopic("testTopic");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+ @Test
+ public void testRemoveTopic() {
+ MemoryQueue queue = new MemoryQueue();
+
+ queue.removeTopic("testTopic");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testPut() {
+ MemoryQueue queue = new MemoryQueue();
+
+ try {
+ queue.put("testTopic", null);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGet() {
+ MemoryQueue queue = new MemoryQueue();
+
+ queue.get("testTopic", "consumer");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.backends.memory;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.backends.memory.MessageLogger;\r
-\r
-\r
-public class MessageLoggerTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSendMessage() {\r
- MessageLogger dropper = new MessageLogger();\r
- \r
- try {\r
- dropper.sendMessage("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSendMessages() {\r
- MessageLogger dropper = new MessageLogger();\r
- \r
- try {\r
- dropper.sendMessages("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSendBatchMessage() {\r
- MessageLogger dropper = new MessageLogger();\r
- \r
- try {\r
- dropper.sendBatchMessageNew("testTopic", null);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
-\r
-\r
-\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.backends.memory.MessageLogger;
+
+
+public class MessageLoggerTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSendMessage() {
+ MessageLogger dropper = new MessageLogger();
+
+ try {
+ dropper.sendMessage("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSendMessages() {
+ MessageLogger dropper = new MessageLogger();
+
+ try {
+ dropper.sendMessages("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSendBatchMessage() {
+ MessageLogger dropper = new MessageLogger();
+
+ try {
+ dropper.sendBatchMessageNew("testTopic", null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
+
+
+
+
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.backends.memory;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetEmail() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.getEmail();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetEmail() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.getEmail();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest2 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetEmail() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.setEmail("rs857c@att.com");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest2 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetEmail() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.setEmail("rs857c@att.com");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest3 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetDescription() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.getDescription();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest3 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetDescription() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.getDescription();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest4 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetDescription() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.setDescription("new testing description");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest4 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetDescription() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.setDescription("new testing description");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest5 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSharedSecret() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.getSharedSecret();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest5 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSharedSecret() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.getSharedSecret();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.nsa.metrics.CdmMetricsRegistry;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ApiKeyBeanTest6 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetKey() {\r
- \r
- ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");\r
- \r
- bean.getKey();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import com.att.nsa.metrics.CdmMetricsRegistry;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ApiKeyBeanTest6 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetKey() {
+
+ ApiKeyBean bean = new ApiKeyBean("hs647a@att.com", "testing bean");
+
+ bean.getKey();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPCambriaLimiter;\r
-\r
-public class DMaaPCambriaLimiterTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSleepMsForRate() {\r
- \r
- \r
- double value = 3;\r
- DMaaPCambriaLimiter.getSleepMsForRate(value);\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testOnCall() {\r
- \r
- DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(1,2, 3);\r
- try {\r
- limiter.onCall("testTopic", "ConsumerGroup1", "client2","remoteHost");\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testOnSend() {\r
- \r
- DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(3,3, 3);\r
- limiter.onSend("testTopic", "consumerGroup1", "client1", 100);\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPCambriaLimiter;
+
+public class DMaaPCambriaLimiterTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSleepMsForRate() {
+
+
+ double value = 3;
+ DMaaPCambriaLimiter.getSleepMsForRate(value);
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testOnCall() {
+
+ DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(1,2, 3);
+ try {
+ limiter.onCall("testTopic", "ConsumerGroup1", "client2","remoteHost");
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testOnSend() {
+
+ DMaaPCambriaLimiter limiter = new DMaaPCambriaLimiter(3,3, 3);
+ limiter.onSend("testTopic", "consumerGroup1", "client1", 100);
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetBatchID() {\r
- \r
- DMaaPContext.getBatchID();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetBatchID() {
+
+ DMaaPContext.getBatchID();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest2 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetRequest() {\r
- \r
- DMaaPContext context = new DMaaPContext();\r
- \r
- context.getRequest();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest2 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetRequest() {
+
+ DMaaPContext context = new DMaaPContext();
+
+ context.getRequest();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest3 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetResponse() {\r
- \r
- DMaaPContext context = new DMaaPContext();\r
- \r
- context.getResponse();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest3 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetResponse() {
+
+ DMaaPContext context = new DMaaPContext();
+
+ context.getResponse();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest4 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSession() {\r
- \r
- DMaaPContext context = new DMaaPContext();\r
- MockHttpServletRequest request = new MockHttpServletRequest();\r
- context.setRequest(request);\r
- \r
- context.getSession();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest4 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSession() {
+
+ DMaaPContext context = new DMaaPContext();
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ context.setRequest(request);
+
+ context.getSession();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest5 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetConfigReader() {\r
- \r
- DMaaPContext context = new DMaaPContext();\r
- \r
- context.getConfigReader();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest5 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetConfigReader() {
+
+ DMaaPContext context = new DMaaPContext();
+
+ context.getConfigReader();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-\r
-public class DMaaPContextTest6 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetConsumerRequestTime() {\r
- \r
- DMaaPContext context = new DMaaPContext();\r
- \r
- context.getConsumerRequestTime();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+
+public class DMaaPContextTest6 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetConsumerRequestTime() {
+
+ DMaaPContext context = new DMaaPContext();
+
+ context.getConsumerRequestTime();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package com.att.nsa.cambria.beans;
+ package org.onap.dmaap.mr.cambria.beans;
import static org.junit.Assert.assertTrue;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import com.att.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
import org.apache.kafka.clients.admin.AdminClient;
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;
-import com.att.dmf.mr.constants.CambriaConstants;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.dmf.mr.metabroker.Broker1.TopicExistsException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.metabroker.Broker1.TopicExistsException;
import com.att.nsa.configs.ConfigDb;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.configs.ConfigPath;
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ ApiKeyBeanTest.class, ApiKeyBeanTest2.class, ApiKeyBeanTest3.class, ApiKeyBeanTest4.class, ApiKeyBeanTest5.class, ApiKeyBeanTest6.class, \r
- DMaaPCambriaLimiterTest.class, DMaaPContextTest.class, DMaaPContextTest2.class, \r
- DMaaPContextTest3.class,DMaaPContextTest4.class,DMaaPContextTest5.class,DMaaPContextTest6.class,\r
- LogDetailsTest.class, LogDetailsTest2.class,LogDetailsTest3.class,LogDetailsTest4.class,LogDetailsTest5.class,LogDetailsTest6.class,\r
- LogDetailsTest7.class,LogDetailsTest8.class,LogDetailsTest9.class,LogDetailsTest10.class,LogDetailsTest11.class,LogDetailsTest12.class,\r
- LogDetailsTest13.class,LogDetailsTest14.class,LogDetailsTest15.class,LogDetailsTest16.class, TopicBeanTest.class,TopicBeanTest2.class,TopicBeanTest3.class,\r
- TopicBeanTest4.class,TopicBeanTest5.class,TopicBeanTest6.class,TopicBeanTest7.class,TopicBeanTest8.class,TopicBeanTest9.class,TopicBeanTest10.class,})\r
-\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ ApiKeyBeanTest.class, ApiKeyBeanTest2.class, ApiKeyBeanTest3.class, ApiKeyBeanTest4.class, ApiKeyBeanTest5.class, ApiKeyBeanTest6.class,
+ DMaaPCambriaLimiterTest.class, DMaaPContextTest.class, DMaaPContextTest2.class,
+ DMaaPContextTest3.class,DMaaPContextTest4.class,DMaaPContextTest5.class,DMaaPContextTest6.class,
+ LogDetailsTest.class, LogDetailsTest2.class,LogDetailsTest3.class,LogDetailsTest4.class,LogDetailsTest5.class,LogDetailsTest6.class,
+ LogDetailsTest7.class,LogDetailsTest8.class,LogDetailsTest9.class,LogDetailsTest10.class,LogDetailsTest11.class,LogDetailsTest12.class,
+ LogDetailsTest13.class,LogDetailsTest14.class,LogDetailsTest15.class,LogDetailsTest16.class, TopicBeanTest.class,TopicBeanTest2.class,TopicBeanTest3.class,
+ TopicBeanTest4.class,TopicBeanTest5.class,TopicBeanTest6.class,TopicBeanTest7.class,TopicBeanTest8.class,TopicBeanTest9.class,TopicBeanTest10.class,})
+
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPublisherId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getPublisherId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGetPublisherLogDetails(){\r
- \r
- LogDetails details = new LogDetails();\r
- details.setTotalMessageCount(1);\r
- details.setConsumeTimestamp("02-27-1018");\r
- details.setSubscriberGroupId("1");\r
- details.setSubscriberId("1");\r
- assertEquals(details.getTotalMessageCount(),1);\r
- assertEquals(details.getConsumeTimestamp(),"02-27-1018");\r
- assertEquals(details.getSubscriberId(),"1");\r
- assertEquals(details.getSubscriberGroupId(),"1");\r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPublisherId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getPublisherId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetPublisherLogDetails(){
+
+ LogDetails details = new LogDetails();
+ details.setTotalMessageCount(1);
+ details.setConsumeTimestamp("02-27-1018");
+ details.setSubscriberGroupId("1");
+ details.setSubscriberId("1");
+ assertEquals(details.getTotalMessageCount(),1);
+ assertEquals(details.getConsumeTimestamp(),"02-27-1018");
+ assertEquals(details.getSubscriberId(),"1");
+ assertEquals(details.getSubscriberGroupId(),"1");
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest10 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPublishTimestamp() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getPublishTimestamp();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest10 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPublishTimestamp() {
+
+ LogDetails details = new LogDetails();
+
+ details.getPublishTimestamp();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest11 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetMessageLengthInBytes() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getMessageLengthInBytes();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest11 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetMessageLengthInBytes() {
+
+ LogDetails details = new LogDetails();
+
+ details.getMessageLengthInBytes();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest12 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetConsumeTimestamp() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getConsumeTimestamp();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest12 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetConsumeTimestamp() {
+
+ LogDetails details = new LogDetails();
+
+ details.getConsumeTimestamp();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest13 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTotalMessageCount() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getTotalMessageCount();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest13 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTotalMessageCount() {
+
+ LogDetails details = new LogDetails();
+
+ details.getTotalMessageCount();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest14 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testIsTransactionEnabled() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.isTransactionEnabled();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest14 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testIsTransactionEnabled() {
+
+ LogDetails details = new LogDetails();
+
+ details.isTransactionEnabled();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest15 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTransactionIdTs() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getTransactionIdTs();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest15 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTransactionIdTs() {
+
+ LogDetails details = new LogDetails();
+
+ details.getTransactionIdTs();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest16 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetServerIp() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getServerIp();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest16 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetServerIp() {
+
+ LogDetails details = new LogDetails();
+
+ details.getServerIp();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest17 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPublisherLogDetails() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getPublisherLogDetails();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest17 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPublisherLogDetails() {
+
+ LogDetails details = new LogDetails();
+
+ details.getPublisherLogDetails();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest18 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPublisherLogDetails() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getPublisherLogDetails();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest18 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPublisherLogDetails() {
+
+ LogDetails details = new LogDetails();
+
+ details.getPublisherLogDetails();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest2 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTransactionId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getTransactionId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest2 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTransactionId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getTransactionId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest3 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTopicId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getTopicId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest3 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTopicId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getTopicId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest4 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSubscriberGroupId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getSubscriberGroupId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest4 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSubscriberGroupId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getSubscriberGroupId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest5 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSubscriberId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getSubscriberId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest5 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSubscriberId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getSubscriberId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest6 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPublisherIp() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getPublisherIp();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest6 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPublisherIp() {
+
+ LogDetails details = new LogDetails();
+
+ details.getPublisherIp();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest7 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetMessageBatchId() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getMessageBatchId();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest7 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetMessageBatchId() {
+
+ LogDetails details = new LogDetails();
+
+ details.getMessageBatchId();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest8 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetMessageTimestamp() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getMessageTimestamp();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest8 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetMessageTimestamp() {
+
+ LogDetails details = new LogDetails();
+
+ details.getMessageTimestamp();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class LogDetailsTest9 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetMessageSequence() {\r
- \r
- LogDetails details = new LogDetails();\r
- \r
- details.getMessageSequence();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class LogDetailsTest9 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetMessageSequence() {
+
+ LogDetails details = new LogDetails();
+
+ details.getMessageSequence();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTopicName() {\r
- \r
- TopicBean bean = new TopicBean();\r
- \r
- bean.getTopicName();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTopicName() {
+
+ TopicBean bean = new TopicBean();
+
+ bean.getTopicName();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest10 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetTransactionEnabled() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.setTransactionEnabled(true);\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest10 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetTransactionEnabled() {
+
+ TopicBean bean = new TopicBean();
+ bean.setTransactionEnabled(true);
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest2 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetTopicName() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.setTopicName("testTopic");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest2 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetTopicName() {
+
+ TopicBean bean = new TopicBean();
+ bean.setTopicName("testTopic");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest3 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetPartitionCount() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.getPartitionCount();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest3 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetPartitionCount() {
+
+ TopicBean bean = new TopicBean();
+ bean.getPartitionCount();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest4 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetPartitionCount() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.setPartitionCount(8);\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest4 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetPartitionCount() {
+
+ TopicBean bean = new TopicBean();
+ bean.setPartitionCount(8);
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest5 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetReplicationCount() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.getReplicationCount();\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest5 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetReplicationCount() {
+
+ TopicBean bean = new TopicBean();
+ bean.getReplicationCount();
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest6 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetReplicationCount() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.setReplicationCount(3);\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest6 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetReplicationCount() {
+
+ TopicBean bean = new TopicBean();
+ bean.setReplicationCount(3);
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest7 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testIsTransactionEnabled() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.isTransactionEnabled();\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest7 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testIsTransactionEnabled() {
+
+ TopicBean bean = new TopicBean();
+ bean.isTransactionEnabled();
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest8 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetTopicDescription() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.getTopicDescription();\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest8 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetTopicDescription() {
+
+ TopicBean bean = new TopicBean();
+ bean.getTopicDescription();
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.beans;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.TopicBean;\r
-\r
-public class TopicBeanTest9 {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSetTopicDescription() {\r
- \r
- TopicBean bean = new TopicBean();\r
- bean.setTopicDescription("testing topic");\r
- \r
- /* String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));*/\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.beans;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+
+public class TopicBeanTest9 {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSetTopicDescription() {
+
+ TopicBean bean = new TopicBean();
+ bean.setTopicDescription("testing topic");
+
+ /* String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));*/
+
+ }
+
+
+
+}
-/*******************************************************************************\r
- * ============LICENSE_START=======================================================\r
- * org.onap.dmaap\r
- * ================================================================================\r
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- *\r
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * \r
- *******************************************************************************/\r
-\r
-package com.att.nsa.cambria.embed;\r
-\r
-import java.io.File;\r
-import java.util.Arrays;\r
-import java.util.Map;\r
-import java.util.Properties;\r
-\r
-import org.apache.commons.io.FileUtils;\r
-import org.apache.curator.framework.CuratorFramework;\r
-\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.backends.kafka.KafkaPublisher;\r
-import com.att.dmf.mr.backends.memory.MemoryMetaBroker;\r
-import com.att.dmf.mr.backends.memory.MemoryQueue;\r
-import org.apache.kafka.clients.admin.AdminClient;\r
-import org.apache.kafka.clients.admin.AdminClientConfig;\r
-import org.apache.kafka.clients.admin.CreateTopicsResult;\r
-import org.apache.kafka.clients.admin.NewTopic;\r
-import org.apache.kafka.common.KafkaFuture;\r
-import com.att.dmf.mr.beans.DMaaPKafkaConsumerFactory;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.beans.DMaaPMetricsSet;\r
-import com.att.dmf.mr.beans.DMaaPZkClient;\r
-import com.att.dmf.mr.beans.DMaaPZkConfigDb;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPCuratorFactory;\r
-import com.att.dmf.mr.utils.PropertyReader;\r
-import com.att.nsa.security.db.BaseNsaApiDbImpl;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKeyFactory;\r
-\r
-\r
-public class EmbedConfigurationReader {\r
- private static final String DEFAULT_KAFKA_LOG_DIR = "/kafka_embedded";\r
- public static final String TEST_TOPIC = "testTopic";\r
- private static final int BROKER_ID = 0;\r
- private static final int BROKER_PORT = 5000;\r
- private static final String LOCALHOST_BROKER = String.format("localhost:%d", BROKER_PORT);\r
-\r
- private static final String DEFAULT_ZOOKEEPER_LOG_DIR = "/zookeeper";\r
- private static final int ZOOKEEPER_PORT = 2000;\r
- private static final String ZOOKEEPER_HOST = String.format("localhost:%d", ZOOKEEPER_PORT);\r
-\r
- private static final String groupId = "groupID";\r
- String dir;\r
- private AdminClient fKafkaAdminClient;\r
- KafkaLocal kafkaLocal;\r
- \r
- public void setUp() throws Exception {\r
- \r
- ClassLoader classLoader = getClass().getClassLoader(); \r
- AJSCPropertiesMap.refresh(new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()));\r
- \r
- Properties kafkaProperties;\r
- Properties zkProperties;\r
-\r
- try {\r
- //load properties\r
- dir = new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()).getParent();\r
- kafkaProperties = getKafkaProperties(dir + DEFAULT_KAFKA_LOG_DIR, BROKER_PORT, BROKER_ID);\r
- zkProperties = getZookeeperProperties(ZOOKEEPER_PORT,dir + DEFAULT_ZOOKEEPER_LOG_DIR);\r
-\r
- //start kafkaLocalServer\r
- kafkaLocal = new KafkaLocal(kafkaProperties, zkProperties);\r
- \r
- Map<String, String> map = com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperties(CambriaConstants.msgRtr_prop);\r
- map.put(CambriaConstants.kSetting_ZkConfigDbServers, ZOOKEEPER_HOST);\r
- map.put("kafka.client.zookeeper", ZOOKEEPER_HOST);\r
- map.put("kafka.metadata.broker.list", LOCALHOST_BROKER);\r
- \r
- DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(new PropertyReader());\r
- \r
- final Properties props = new Properties ();\r
- props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092" );\r
- props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username='admin' password='admin_secret'");\r
- props.put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, "SASL_PLAINTEXT"); \r
- props.put("sasl.mechanism", "PLAIN");\r
- fKafkaAdminClient = AdminClient.create ( props );\r
- \r
- // if(!AdminUtils.topicExists(dMaaPZkClient, TEST_TOPIC))\r
- // AdminUtils.createTopic(dMaaPZkClient, TEST_TOPIC, 3, 1, new Properties());\r
- final NewTopic topicRequest = new NewTopic ( TEST_TOPIC, 3, new Integer(1).shortValue () );\r
- fKafkaAdminClient.createTopics ( Arrays.asList ( topicRequest ) );\r
- Thread.sleep(5000);\r
- } catch (Exception e){\r
- e.printStackTrace(System.out);\r
- } \r
- }\r
- \r
- private static Properties getKafkaProperties(String logDir, int port, int brokerId) {\r
- Properties properties = new Properties();\r
- properties.put("port", port + "");\r
- properties.put("broker.id", brokerId + "");\r
- properties.put("log.dir", logDir);\r
- properties.put("zookeeper.connect", ZOOKEEPER_HOST);\r
- properties.put("default.replication.factor", "1");\r
- properties.put("delete.topic.enable", "true");\r
- properties.put("consumer.timeout.ms", -1);\r
- return properties;\r
- }\r
- \r
- private static Properties getZookeeperProperties(int port, String zookeeperDir) {\r
- Properties properties = new Properties();\r
- properties.put("clientPort", port + "");\r
- properties.put("dataDir", zookeeperDir);\r
- return properties;\r
- }\r
-\r
- public void tearDown() throws Exception {\r
- DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(new PropertyReader());\r
- if(fKafkaAdminClient!=null)\r
- fKafkaAdminClient.deleteTopics(Arrays.asList(TEST_TOPIC));\r
- //AdminUtils.deleteTopic(dMaaPZkClient, TEST_TOPIC);\r
- //dMaaPZkClient.delete(dir + DEFAULT_KAFKA_LOG_DIR);\r
- //dMaaPZkClient.delete(dir + DEFAULT_ZOOKEEPER_LOG_DIR);\r
- kafkaLocal.stop();\r
- FileUtils.cleanDirectory(new File(dir + DEFAULT_KAFKA_LOG_DIR)); \r
- }\r
-\r
-\r
- public ConfigurationReader buildConfigurationReader() throws Exception {\r
- \r
- setUp();\r
- \r
- PropertyReader propertyReader = new PropertyReader();\r
- DMaaPMetricsSet dMaaPMetricsSet = new DMaaPMetricsSet(propertyReader);\r
- DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(propertyReader);\r
- DMaaPZkConfigDb dMaaPZkConfigDb = new DMaaPZkConfigDb(dMaaPZkClient, propertyReader);\r
- CuratorFramework curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());\r
- DMaaPKafkaConsumerFactory dMaaPKafkaConsumerFactory = new DMaaPKafkaConsumerFactory(dMaaPMetricsSet, curatorFramework,null);\r
- MemoryQueue memoryQueue = new MemoryQueue();\r
- MemoryMetaBroker memoryMetaBroker = new MemoryMetaBroker(memoryQueue, dMaaPZkConfigDb);\r
- BaseNsaApiDbImpl<NsaSimpleApiKey> baseNsaApiDbImpl = new BaseNsaApiDbImpl<>(dMaaPZkConfigDb, new NsaSimpleApiKeyFactory());\r
- DMaaPAuthenticator<NsaSimpleApiKey> dMaaPAuthenticator = new DMaaPAuthenticatorImpl<>(baseNsaApiDbImpl);\r
- KafkaPublisher kafkaPublisher = new KafkaPublisher(propertyReader);\r
- DMaaPKafkaMetaBroker dMaaPKafkaMetaBroker = new DMaaPKafkaMetaBroker(propertyReader, dMaaPZkClient, dMaaPZkConfigDb);\r
- \r
- return new ConfigurationReader(propertyReader, \r
- dMaaPMetricsSet, dMaaPZkClient, dMaaPZkConfigDb, kafkaPublisher, \r
- curatorFramework, dMaaPKafkaConsumerFactory, dMaaPKafkaMetaBroker, \r
- memoryQueue, memoryMetaBroker, baseNsaApiDbImpl, dMaaPAuthenticator);\r
- \r
- }\r
-}\r
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * org.onap.dmaap
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
+ *******************************************************************************/
+
+ package org.onap.dmaap.mr.cambria.embed;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.curator.framework.CuratorFramework;
+
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.backends.kafka.KafkaPublisher;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryMetaBroker;
+import org.onap.dmaap.dmf.mr.backends.memory.MemoryQueue;
+import org.apache.kafka.clients.admin.AdminClient;
+import org.apache.kafka.clients.admin.AdminClientConfig;
+import org.apache.kafka.clients.admin.CreateTopicsResult;
+import org.apache.kafka.clients.admin.NewTopic;
+import org.apache.kafka.common.KafkaFuture;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.beans.DMaaPMetricsSet;
+import org.onap.dmaap.dmf.mr.beans.DMaaPZkClient;
+import org.onap.dmaap.dmf.mr.beans.DMaaPZkConfigDb;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPCuratorFactory;
+import org.onap.dmaap.dmf.mr.utils.PropertyReader;
+import com.att.nsa.security.db.BaseNsaApiDbImpl;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+import com.att.nsa.security.db.simple.NsaSimpleApiKeyFactory;
+
+
+public class EmbedConfigurationReader {
+ private static final String DEFAULT_KAFKA_LOG_DIR = "/kafka_embedded";
+ public static final String TEST_TOPIC = "testTopic";
+ private static final int BROKER_ID = 0;
+ private static final int BROKER_PORT = 5000;
+ private static final String LOCALHOST_BROKER = String.format("localhost:%d", BROKER_PORT);
+
+ private static final String DEFAULT_ZOOKEEPER_LOG_DIR = "/zookeeper";
+ private static final int ZOOKEEPER_PORT = 2000;
+ private static final String ZOOKEEPER_HOST = String.format("localhost:%d", ZOOKEEPER_PORT);
+
+ private static final String groupId = "groupID";
+ String dir;
+ private AdminClient fKafkaAdminClient;
+ KafkaLocal kafkaLocal;
+
+ public void setUp() throws Exception {
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ AJSCPropertiesMap.refresh(new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()));
+
+ Properties kafkaProperties;
+ Properties zkProperties;
+
+ try {
+ //load properties
+ dir = new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()).getParent();
+ kafkaProperties = getKafkaProperties(dir + DEFAULT_KAFKA_LOG_DIR, BROKER_PORT, BROKER_ID);
+ zkProperties = getZookeeperProperties(ZOOKEEPER_PORT,dir + DEFAULT_ZOOKEEPER_LOG_DIR);
+
+ //start kafkaLocalServer
+ kafkaLocal = new KafkaLocal(kafkaProperties, zkProperties);
+
+ Map<String, String> map = com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperties(CambriaConstants.msgRtr_prop);
+ map.put(CambriaConstants.kSetting_ZkConfigDbServers, ZOOKEEPER_HOST);
+ map.put("kafka.client.zookeeper", ZOOKEEPER_HOST);
+ map.put("kafka.metadata.broker.list", LOCALHOST_BROKER);
+
+ DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(new PropertyReader());
+
+ final Properties props = new Properties ();
+ props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092" );
+ props.put("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username='admin' password='admin_secret'");
+ props.put(AdminClientConfig.SECURITY_PROTOCOL_CONFIG, "SASL_PLAINTEXT");
+ props.put("sasl.mechanism", "PLAIN");
+ fKafkaAdminClient = AdminClient.create ( props );
+
+ // if(!AdminUtils.topicExists(dMaaPZkClient, TEST_TOPIC))
+ // AdminUtils.createTopic(dMaaPZkClient, TEST_TOPIC, 3, 1, new Properties());
+ final NewTopic topicRequest = new NewTopic ( TEST_TOPIC, 3, new Integer(1).shortValue () );
+ fKafkaAdminClient.createTopics ( Arrays.asList ( topicRequest ) );
+ Thread.sleep(5000);
+ } catch (Exception e){
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private static Properties getKafkaProperties(String logDir, int port, int brokerId) {
+ Properties properties = new Properties();
+ properties.put("port", port + "");
+ properties.put("broker.id", brokerId + "");
+ properties.put("log.dir", logDir);
+ properties.put("zookeeper.connect", ZOOKEEPER_HOST);
+ properties.put("default.replication.factor", "1");
+ properties.put("delete.topic.enable", "true");
+ properties.put("consumer.timeout.ms", -1);
+ return properties;
+ }
+
+ private static Properties getZookeeperProperties(int port, String zookeeperDir) {
+ Properties properties = new Properties();
+ properties.put("clientPort", port + "");
+ properties.put("dataDir", zookeeperDir);
+ return properties;
+ }
+
+ public void tearDown() throws Exception {
+ DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(new PropertyReader());
+ if(fKafkaAdminClient!=null)
+ fKafkaAdminClient.deleteTopics(Arrays.asList(TEST_TOPIC));
+ //AdminUtils.deleteTopic(dMaaPZkClient, TEST_TOPIC);
+ //dMaaPZkClient.delete(dir + DEFAULT_KAFKA_LOG_DIR);
+ //dMaaPZkClient.delete(dir + DEFAULT_ZOOKEEPER_LOG_DIR);
+ kafkaLocal.stop();
+ FileUtils.cleanDirectory(new File(dir + DEFAULT_KAFKA_LOG_DIR));
+ }
+
+
+ public ConfigurationReader buildConfigurationReader() throws Exception {
+
+ setUp();
+
+ PropertyReader propertyReader = new PropertyReader();
+ DMaaPMetricsSet dMaaPMetricsSet = new DMaaPMetricsSet(propertyReader);
+ DMaaPZkClient dMaaPZkClient = new DMaaPZkClient(propertyReader);
+ DMaaPZkConfigDb dMaaPZkConfigDb = new DMaaPZkConfigDb(dMaaPZkClient, propertyReader);
+ CuratorFramework curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());
+ DMaaPKafkaConsumerFactory dMaaPKafkaConsumerFactory = new DMaaPKafkaConsumerFactory(dMaaPMetricsSet, curatorFramework,null);
+ MemoryQueue memoryQueue = new MemoryQueue();
+ MemoryMetaBroker memoryMetaBroker = new MemoryMetaBroker(memoryQueue, dMaaPZkConfigDb);
+ BaseNsaApiDbImpl<NsaSimpleApiKey> baseNsaApiDbImpl = new BaseNsaApiDbImpl<>(dMaaPZkConfigDb, new NsaSimpleApiKeyFactory());
+ DMaaPAuthenticator<NsaSimpleApiKey> dMaaPAuthenticator = new DMaaPAuthenticatorImpl<>(baseNsaApiDbImpl);
+ KafkaPublisher kafkaPublisher = new KafkaPublisher(propertyReader);
+ DMaaPKafkaMetaBroker dMaaPKafkaMetaBroker = new DMaaPKafkaMetaBroker(propertyReader, dMaaPZkClient, dMaaPZkConfigDb);
+
+ return new ConfigurationReader(propertyReader,
+ dMaaPMetricsSet, dMaaPZkClient, dMaaPZkConfigDb, kafkaPublisher,
+ curatorFramework, dMaaPKafkaConsumerFactory, dMaaPKafkaMetaBroker,
+ memoryQueue, memoryMetaBroker, baseNsaApiDbImpl, dMaaPAuthenticator);
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.embed;\r
-\r
-import java.io.IOException;\r
-import java.util.Properties;\r
-\r
-import kafka.server.KafkaConfig;\r
-import kafka.server.KafkaServerStartable;\r
- \r
- \r
-public class KafkaLocal {\r
- \r
- public KafkaServerStartable kafka;\r
- public ZooKeeperLocal zookeeper;\r
- \r
- public KafkaLocal(Properties kafkaProperties, Properties zkProperties) throws IOException, InterruptedException{\r
- KafkaConfig kafkaConfig = new KafkaConfig(kafkaProperties);\r
- \r
- //start local zookeeper\r
- System.out.println("starting local zookeeper...");\r
- zookeeper = new ZooKeeperLocal(zkProperties);\r
- System.out.println("done");\r
- \r
- //start local kafka broker\r
- kafka = new KafkaServerStartable(kafkaConfig);\r
- System.out.println("starting local kafka broker...");\r
- kafka.startup();\r
- System.out.println("done");\r
- }\r
- \r
- \r
- public void stop(){\r
- //stop kafka broker\r
- System.out.println("stopping kafka...");\r
- kafka.shutdown();\r
- System.out.println("done");\r
- }\r
- \r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.embed;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import kafka.server.KafkaConfig;
+import kafka.server.KafkaServerStartable;
+
+
+public class KafkaLocal {
+
+ public KafkaServerStartable kafka;
+ public ZooKeeperLocal zookeeper;
+
+ public KafkaLocal(Properties kafkaProperties, Properties zkProperties) throws IOException, InterruptedException{
+ KafkaConfig kafkaConfig = new KafkaConfig(kafkaProperties);
+
+ //start local zookeeper
+ System.out.println("starting local zookeeper...");
+ zookeeper = new ZooKeeperLocal(zkProperties);
+ System.out.println("done");
+
+ //start local kafka broker
+ kafka = new KafkaServerStartable(kafkaConfig);
+ System.out.println("starting local kafka broker...");
+ kafka.startup();
+ System.out.println("done");
+ }
+
+
+ public void stop(){
+ //stop kafka broker
+ System.out.println("stopping kafka...");
+ kafka.shutdown();
+ System.out.println("done");
+ }
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.embed;\r
-\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.util.Properties;\r
- \r
-import org.apache.zookeeper.server.ServerConfig;\r
-import org.apache.zookeeper.server.ZooKeeperServerMain;\r
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;\r
- \r
-public class ZooKeeperLocal {\r
- \r
- ZooKeeperServerMain zooKeeperServer;\r
- \r
- public ZooKeeperLocal(Properties zkProperties) throws FileNotFoundException, IOException{\r
- QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();\r
- try {\r
- quorumConfiguration.parseProperties(zkProperties);\r
- } catch(Exception e) {\r
- throw new RuntimeException(e);\r
- }\r
- \r
- zooKeeperServer = new ZooKeeperServerMain();\r
- final ServerConfig configuration = new ServerConfig();\r
- configuration.readFrom(quorumConfiguration);\r
- \r
- \r
- new Thread() {\r
- public void run() {\r
- try {\r
- zooKeeperServer.runFromConfig(configuration);\r
- } catch (IOException e) {\r
- System.out.println("ZooKeeper Failed");\r
- e.printStackTrace(System.err);\r
- }\r
- }\r
- }.start();\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.embed;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+
+public class ZooKeeperLocal {
+
+ ZooKeeperServerMain zooKeeperServer;
+
+ public ZooKeeperLocal(Properties zkProperties) throws FileNotFoundException, IOException{
+ QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
+ try {
+ quorumConfiguration.parseProperties(zkProperties);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ zooKeeperServer = new ZooKeeperServerMain();
+ final ServerConfig configuration = new ServerConfig();
+ configuration.readFrom(quorumConfiguration);
+
+
+ new Thread() {
+ public void run() {
+ try {
+ zooKeeperServer.runFromConfig(configuration);
+ } catch (IOException e) {
+ System.out.println("ZooKeeper Failed");
+ e.printStackTrace(System.err);
+ }
+ }
+ }.start();
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import static org.junit.Assert.*;\r
-import com.att.dmf.mr.exception.DMaaPCambriaExceptionMapper;\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class DMaaPCambriaExceptionMapperTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- DMaaPCambriaExceptionMapper exception = new DMaaPCambriaExceptionMapper();\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- \r
- }\r
-\r
- \r
- @Test\r
- public void testToResponse() {\r
- \r
- DMaaPCambriaExceptionMapper mapper = new DMaaPCambriaExceptionMapper();\r
- \r
- try {\r
- mapper.toResponse(null);\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
- \r
- \r
- \r
- }\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import static org.junit.Assert.*;
+import org.onap.dmaap.dmf.mr.exception.DMaaPCambriaExceptionMapper;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPCambriaExceptionMapperTest {
+
+ @Before
+ public void setUp() throws Exception {
+ DMaaPCambriaExceptionMapper exception = new DMaaPCambriaExceptionMapper();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testToResponse() {
+
+ DMaaPCambriaExceptionMapper mapper = new DMaaPCambriaExceptionMapper();
+
+ try {
+ mapper.toResponse(null);
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+
+
+ }
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import static org.junit.Assert.*;\r
-import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class DMaaPErrorMessagesTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- \r
- }\r
-\r
- \r
- @Test\r
- public void testGetMsgSizeExceeds() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getMsgSizeExceeds();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetMsgSizeExceeds() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setMsgSizeExceeds("200");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetNotFound() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getNotFound();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetNotFound() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setNotFound("not found");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetServerUnav() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getServerUnav();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetServerUnav() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setServerUnav("server1");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetMethodNotAllowed() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getMethodNotAllowed();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetMethodNotAllowed() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setMethodNotAllowed("server2");\r
- assertTrue(true);\r
-\r
- }\r
- \r
-\r
- @Test\r
- public void testGetBadRequest() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getBadRequest();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetBadRequest() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setBadRequest("badRequest");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetNwTimeout() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getNwTimeout();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetNwTimeout() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setNwTimeout("12:00:00");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetNotPermitted1() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getNotPermitted1();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetNotPermitted1() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setNotPermitted1("not permitted");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetNotPermitted2() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getNotPermitted2();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetNotPermitted2() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setNotPermitted2("not permitted2");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetTopicsfailure() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getTopicsfailure();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetTopicsfailure() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setTopicsfailure("failure");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetTopicDetailsFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getTopicDetailsFail();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetTopicDetailsFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setTopicDetailsFail("topic details fail");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetCreateTopicFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getCreateTopicFail();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetCreateTopicFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setCreateTopicFail("topic details fail");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetIncorrectJson() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getIncorrectJson();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetIncorrectJson() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setIncorrectJson("incorrect Json");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetDeleteTopicFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getDeleteTopicFail();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetDeleteTopicFail() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setDeleteTopicFail("delete tpic fail");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetConsumeMsgError() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getConsumeMsgError();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetConsumeMsgError() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setConsumeMsgError("consume message error");\r
- assertTrue(true);\r
-\r
- }\r
- \r
-\r
- @Test\r
- public void testGetPublishMsgError() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getPublishMsgError();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetPublishMsgError() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setPublishMsgError("publish message error");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetPublishMsgCount() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getPublishMsgCount();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetPublishMsgCount() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setPublishMsgCount("200");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetAuthFailure() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getAuthFailure();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetAuthFailure() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setAuthFailure("auth failure");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetTopicNotExist() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.getTopicNotExist();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetTopicNotExist() {\r
- \r
- DMaaPErrorMessages msg = new DMaaPErrorMessages();\r
- msg.setTopicNotExist("toopic doesn't exist");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- \r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import static org.junit.Assert.*;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPErrorMessagesTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testGetMsgSizeExceeds() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getMsgSizeExceeds();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMsgSizeExceeds() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setMsgSizeExceeds("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotFound() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotFound();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotFound() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotFound("not found");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetServerUnav() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getServerUnav();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetServerUnav() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setServerUnav("server1");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetMethodNotAllowed() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getMethodNotAllowed();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMethodNotAllowed() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setMethodNotAllowed("server2");
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testGetBadRequest() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getBadRequest();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetBadRequest() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setBadRequest("badRequest");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNwTimeout() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNwTimeout();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNwTimeout() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNwTimeout("12:00:00");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotPermitted1() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotPermitted1();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotPermitted1() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotPermitted1("not permitted");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotPermitted2() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotPermitted2();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotPermitted2() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotPermitted2("not permitted2");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicsfailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicsfailure();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicsfailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicsfailure("failure");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicDetailsFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicDetailsFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicDetailsFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicDetailsFail("topic details fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCreateTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getCreateTopicFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetCreateTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setCreateTopicFail("topic details fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetIncorrectJson() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getIncorrectJson();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetIncorrectJson() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setIncorrectJson("incorrect Json");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetDeleteTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getDeleteTopicFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetDeleteTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setDeleteTopicFail("delete tpic fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetConsumeMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getConsumeMsgError();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetConsumeMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setConsumeMsgError("consume message error");
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testGetPublishMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getPublishMsgError();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPublishMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setPublishMsgError("publish message error");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetPublishMsgCount() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getPublishMsgCount();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPublishMsgCount() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setPublishMsgCount("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetAuthFailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getAuthFailure();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetAuthFailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setAuthFailure("auth failure");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicNotExist() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicNotExist();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicNotExist() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicNotExist("toopic doesn't exist");
+ assertTrue(true);
+
+ }
+
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import static org.junit.Assert.*;\r
-import com.att.dmf.mr.exception.DMaaPWebExceptionMapper;\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class DMaaPWebExceptionMapperTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- \r
- }\r
-\r
- \r
- @Test\r
- public void testToResponse() {\r
- \r
- DMaaPWebExceptionMapper msg = new DMaaPWebExceptionMapper();\r
- \r
- try {\r
- msg.toResponse(null);\r
- } catch (Exception e) {\r
- assertTrue(true);\r
- }\r
- \r
- \r
-\r
- }\r
- \r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import static org.junit.Assert.*;
+import org.onap.dmaap.dmf.mr.exception.DMaaPWebExceptionMapper;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPWebExceptionMapperTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testToResponse() {
+
+ DMaaPWebExceptionMapper msg = new DMaaPWebExceptionMapper();
+
+ try {
+ msg.toResponse(null);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+
+
+
+ }
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import static org.junit.Assert.*;\r
-import com.att.dmf.mr.exception.ErrorResponse;\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ErrorResponseTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- \r
- }\r
-\r
- \r
- @Test\r
- public void testGetHttpStatusCode() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.getHttpStatusCode();\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void tesSGetHttpStatusCode() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.setHttpStatusCode(200);\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testGetMrErrorCode() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.getMrErrorCode();\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testSetMrErrorCode() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.setMrErrorCode(500);\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testGetErrorMessage() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.getErrorMessage();\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testSetErrorMessage() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.setErrorMessage("no error");\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testToString() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.toString();\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testGetErrMapperStr1() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.setHelpURL("/help");\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- @Test\r
- public void testGetErrMapperStr() {\r
- \r
- ErrorResponse resp = new ErrorResponse(200, 500, "no error");\r
- \r
- resp.getHelpURL();\r
- assertTrue(true);\r
- \r
-\r
- }\r
- \r
- \r
- \r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import static org.junit.Assert.*;
+import org.onap.dmaap.dmf.mr.exception.ErrorResponse;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ErrorResponseTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testGetHttpStatusCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getHttpStatusCode();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void tesSGetHttpStatusCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setHttpStatusCode(200);
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetMrErrorCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getMrErrorCode();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testSetMrErrorCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setMrErrorCode(500);
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrorMessage() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getErrorMessage();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testSetErrorMessage() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setErrorMessage("no error");
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testToString() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.toString();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrMapperStr1() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setHelpURL("/help");
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrMapperStr() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getHelpURL();
+ assertTrue(true);
+
+
+ }
+
+
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.exception;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPCambriaExceptionMapperTest.class,\r
- DMaaPErrorMessagesTest.class, DMaaPWebExceptionMapperTest.class, ErrorResponseTest.class})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPCambriaExceptionMapperTest.class,
+ DMaaPErrorMessagesTest.class, DMaaPWebExceptionMapperTest.class, ErrorResponseTest.class})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.exception;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.listener;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.ServletContextEvent;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.listener.CambriaServletContextListener;\r
-\r
-public class CambriaServletContextListenerTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testContextDestroyed() {\r
- CambriaServletContextListener listener = new CambriaServletContextListener();\r
- try {\r
- listener.contextDestroyed(null);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testContextInitialized() {\r
- CambriaServletContextListener listener = new CambriaServletContextListener();\r
- \r
- try {\r
- listener.contextInitialized(null);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- \r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+ package org.onap.dmaap.mr.cambria.listener;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.ServletContextEvent;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.listener.CambriaServletContextListener;
+
+public class CambriaServletContextListenerTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testContextDestroyed() {
+ CambriaServletContextListener listener = new CambriaServletContextListener();
+ try {
+ listener.contextDestroyed(null);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testContextInitialized() {
+ CambriaServletContextListener listener = new CambriaServletContextListener();
+
+ try {
+ listener.contextInitialized(null);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.listener;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.listener.DME2EndPointLoader;\r
-\r
-public class DME2EndPointLoaderTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testPublishEndPoints() {\r
- DME2EndPointLoader loader = DME2EndPointLoader.getInstance();\r
- \r
- \r
- try {\r
- loader.publishEndPoints();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testUnPublishEndPoints() {\r
- DME2EndPointLoader loader = DME2EndPointLoader.getInstance();\r
- \r
- \r
- try {\r
- loader.unPublishEndPoints();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.listener;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.listener.DME2EndPointLoader;
+
+public class DME2EndPointLoaderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testPublishEndPoints() {
+ DME2EndPointLoader loader = DME2EndPointLoader.getInstance();
+
+
+ try {
+ loader.publishEndPoints();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testUnPublishEndPoints() {
+ DME2EndPointLoader loader = DME2EndPointLoader.getInstance();
+
+
+ try {
+ loader.unPublishEndPoints();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.listener;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DME2EndPointLoaderTest.class, CambriaServletContextListenerTest.class })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+ package org.onap.dmaap.mr.cambria.listener;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DME2EndPointLoaderTest.class, CambriaServletContextListenerTest.class })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.listener;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.metabroker.Broker;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-\r
-public class BrokerImpl implements Broker {\r
-\r
- @Override\r
- public List<Topic> getAllTopics() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- Topic top = new TopicImplem();\r
-\r
- List<Topic> list = new ArrayList<Topic>();\r
-\r
- for (int i = 0; i < 5; i++) {\r
- top = new TopicImplem();\r
- list.add(top);\r
-\r
- }\r
-\r
- return null;\r
-\r
- }\r
-\r
- @Override\r
- public Topic getTopic(String topic) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return new TopicImplem();\r
- }\r
-\r
- @Override\r
- public Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,\r
- boolean transactionEnabled) throws TopicExistsException, CambriaApiException {\r
- // TODO Auto-generated method stub\r
- return new TopicImplem(topic, description, ownerApiKey, transactionEnabled);\r
- }\r
-\r
- @Override\r
- public void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException {\r
- // TODO Auto-generated method stub\r
- Topic top = new TopicImplem();\r
-\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.metabroker.Broker;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+
+public class BrokerImpl implements Broker {
+
+ @Override
+ public List<Topic> getAllTopics() throws ConfigDbException {
+ // TODO Auto-generated method stub
+ Topic top = new TopicImplem();
+
+ List<Topic> list = new ArrayList<Topic>();
+
+ for (int i = 0; i < 5; i++) {
+ top = new TopicImplem();
+ list.add(top);
+
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public Topic getTopic(String topic) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return new TopicImplem();
+ }
+
+ @Override
+ public Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,
+ boolean transactionEnabled) throws TopicExistsException, CambriaApiException {
+ // TODO Auto-generated method stub
+ return new TopicImplem(topic, description, ownerApiKey, transactionEnabled);
+ }
+
+ @Override
+ public void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException {
+ // TODO Auto-generated method stub
+ Topic top = new TopicImplem();
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-\r
-public class BrokerImplTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetOwners() {\r
-\r
- try {\r
- new BrokerImpl().getAllTopics();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
- }\r
-\r
- @Test\r
- public void testGetTopic() {\r
-\r
- try {\r
- new BrokerImpl().getTopic("topicName");\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateTopic() {\r
-\r
- try {\r
- new BrokerImpl().createTopic("topicName", "testing topic", "owner123", 3, 3, true);\r
-\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testDeleteTopic() {\r
-\r
- try {\r
- new BrokerImpl().deleteTopic("topicName");\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+
+public class BrokerImplTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetOwners() {
+
+ try {
+ new BrokerImpl().getAllTopics();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+ }
+
+ @Test
+ public void testGetTopic() {
+
+ try {
+ new BrokerImpl().getTopic("topicName");
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateTopic() {
+
+ try {
+ new BrokerImpl().createTopic("topicName", "testing topic", "owner123", 3, 3, true);
+
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDeleteTopic() {
+
+ try {
+ new BrokerImpl().deleteTopic("topicName");
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ BrokerImplTest.class, TopicImplemTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ BrokerImplTest.class, TopicImplemTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-public class TopicImplTest {\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+public class TopicImplTest {
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import java.util.Set;\r
-\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.NsaAcl;\r
-import com.att.nsa.security.NsaApiKey;\r
-\r
-public class TopicImplem implements Topic {\r
- private String name, owner, description;\r
- boolean isTransactionEnabled;\r
- private Set<String> set = null;\r
- private NsaAcl readerAcl, writerAcl;\r
- \r
- public TopicImplem() {\r
- name = getName();\r
- owner = getOwner();\r
- description = getDescription();\r
- isTransactionEnabled = true;\r
- readerAcl = getReaderAcl();\r
- writerAcl = getWriterAcl();\r
- }\r
- \r
- public TopicImplem(String topic, String description, String ownerApiKey, boolean transactionEnabled) {\r
- \r
- this.name = topic;\r
- this.owner = ownerApiKey;\r
- this.description = description;\r
- isTransactionEnabled = transactionEnabled;\r
- \r
- \r
- }\r
- @Override\r
- public Set<String> getOwners() {\r
- // TODO Auto-generated method stub\r
- for (int i = 0; i < 5; i++) {\r
- set.add("string" + (i + 1));\r
- }\r
- return set;\r
- }\r
-\r
- @Override\r
- public String getName() {\r
- // TODO Auto-generated method stub\r
- return "testTopic";\r
- }\r
-\r
- @Override\r
- public String getOwner() {\r
- // TODO Auto-generated method stub\r
- return "owner";\r
- }\r
-\r
- @Override\r
- public String getDescription() {\r
- // TODO Auto-generated method stub\r
- return "topic for testing purposes";\r
- }\r
-\r
- @Override\r
- public boolean isTransactionEnabled() {\r
- // TODO Auto-generated method stub\r
- return true;\r
- }\r
-\r
- @Override\r
- public NsaAcl getReaderAcl() {\r
- // TODO Auto-generated method stub\r
- return new NsaAcl();\r
- }\r
-\r
- @Override\r
- public NsaAcl getWriterAcl() {\r
- // TODO Auto-generated method stub\r
- return new NsaAcl();\r
- }\r
-\r
- @Override\r
- public void checkUserRead(NsaApiKey user) throws AccessDeniedException {\r
- // TODO Auto-generated method stub\r
- NsaApiKey u = user;\r
- }\r
-\r
- @Override\r
- public void checkUserWrite(NsaApiKey user) throws AccessDeniedException {\r
- // TODO Auto-generated method stub\r
- \r
- NsaApiKey u = user;\r
- }\r
-\r
- @Override\r
- public void permitWritesFromUser(String publisherId, NsaApiKey asUser)\r
- throws AccessDeniedException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- String id = publisherId;\r
- \r
- }\r
-\r
- @Override\r
- public void denyWritesFromUser(String publisherId, NsaApiKey asUser)\r
- throws AccessDeniedException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- String id = publisherId;\r
- \r
- }\r
-\r
- @Override\r
- public void permitReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- String id = consumerId;\r
- }\r
-\r
- @Override\r
- public void denyReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- String id = consumerId;\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import java.util.Set;
+
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.NsaAcl;
+import com.att.nsa.security.NsaApiKey;
+
+public class TopicImplem implements Topic {
+ private String name, owner, description;
+ boolean isTransactionEnabled;
+ private Set<String> set = null;
+ private NsaAcl readerAcl, writerAcl;
+
+ public TopicImplem() {
+ name = getName();
+ owner = getOwner();
+ description = getDescription();
+ isTransactionEnabled = true;
+ readerAcl = getReaderAcl();
+ writerAcl = getWriterAcl();
+ }
+
+ public TopicImplem(String topic, String description, String ownerApiKey, boolean transactionEnabled) {
+
+ this.name = topic;
+ this.owner = ownerApiKey;
+ this.description = description;
+ isTransactionEnabled = transactionEnabled;
+
+
+ }
+ @Override
+ public Set<String> getOwners() {
+ // TODO Auto-generated method stub
+ for (int i = 0; i < 5; i++) {
+ set.add("string" + (i + 1));
+ }
+ return set;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return "testTopic";
+ }
+
+ @Override
+ public String getOwner() {
+ // TODO Auto-generated method stub
+ return "owner";
+ }
+
+ @Override
+ public String getDescription() {
+ // TODO Auto-generated method stub
+ return "topic for testing purposes";
+ }
+
+ @Override
+ public boolean isTransactionEnabled() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ @Override
+ public NsaAcl getReaderAcl() {
+ // TODO Auto-generated method stub
+ return new NsaAcl();
+ }
+
+ @Override
+ public NsaAcl getWriterAcl() {
+ // TODO Auto-generated method stub
+ return new NsaAcl();
+ }
+
+ @Override
+ public void checkUserRead(NsaApiKey user) throws AccessDeniedException {
+ // TODO Auto-generated method stub
+ NsaApiKey u = user;
+ }
+
+ @Override
+ public void checkUserWrite(NsaApiKey user) throws AccessDeniedException {
+ // TODO Auto-generated method stub
+
+ NsaApiKey u = user;
+ }
+
+ @Override
+ public void permitWritesFromUser(String publisherId, NsaApiKey asUser)
+ throws AccessDeniedException, ConfigDbException {
+ // TODO Auto-generated method stub
+ String id = publisherId;
+
+ }
+
+ @Override
+ public void denyWritesFromUser(String publisherId, NsaApiKey asUser)
+ throws AccessDeniedException, ConfigDbException {
+ // TODO Auto-generated method stub
+ String id = publisherId;
+
+ }
+
+ @Override
+ public void permitReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
+ // TODO Auto-generated method stub
+ String id = consumerId;
+ }
+
+ @Override
+ public void denyReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
+ // TODO Auto-generated method stub
+ String id = consumerId;
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metabroker;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-\r
-public class TopicImplemTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- \r
- @Test\r
- public void testGetOwners() {\r
-\r
- assertNotNull(new TopicImplem().getOwner());\r
-\r
- }\r
- \r
- @Test\r
- public void testGetName() {\r
-\r
- assertNotNull(new TopicImplem().getName());\r
-\r
- }\r
- \r
- @Test\r
- public void testGetOwner() {\r
-\r
- assertNotNull(new TopicImplem().getOwner());\r
-\r
- }\r
- \r
- @Test\r
- public void testGetDescription() {\r
-\r
- assertNotNull(new TopicImplem().getDescription());\r
-\r
- }\r
- \r
- @Test\r
- public void testIsTransactionEnabled() {\r
-\r
- assertTrue(new TopicImplem().isTransactionEnabled());\r
-\r
- }\r
- \r
- @Test\r
- public void testGetReaderAcl() {\r
- new TopicImplem().getReaderAcl();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetWriterAcl() {\r
- new TopicImplem().getReaderAcl();\r
- assertTrue(true);\r
-\r
- }\r
- \r
-\r
- @Test\r
- public void testCheckUserRead() {\r
- try {\r
- new TopicImplem().checkUserRead(null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testCheckUserWrite() {\r
- try {\r
- new TopicImplem().checkUserWrite(null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testPermitWritesFromUser() {\r
- try {\r
- new TopicImplem().permitWritesFromUser("publisherId", null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testDenyWritesFromUser() {\r
- try {\r
- new TopicImplem().denyWritesFromUser("publisherId", null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testPermitReadsByUser() {\r
- try {\r
- new TopicImplem().permitReadsByUser("consumerId", null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testDenyReadsByUser() {\r
- try {\r
- new TopicImplem().denyReadsByUser("consumerId", null);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metabroker;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+
+public class TopicImplemTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testGetOwners() {
+
+ assertNotNull(new TopicImplem().getOwner());
+
+ }
+
+ @Test
+ public void testGetName() {
+
+ assertNotNull(new TopicImplem().getName());
+
+ }
+
+ @Test
+ public void testGetOwner() {
+
+ assertNotNull(new TopicImplem().getOwner());
+
+ }
+
+ @Test
+ public void testGetDescription() {
+
+ assertNotNull(new TopicImplem().getDescription());
+
+ }
+
+ @Test
+ public void testIsTransactionEnabled() {
+
+ assertTrue(new TopicImplem().isTransactionEnabled());
+
+ }
+
+ @Test
+ public void testGetReaderAcl() {
+ new TopicImplem().getReaderAcl();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetWriterAcl() {
+ new TopicImplem().getReaderAcl();
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testCheckUserRead() {
+ try {
+ new TopicImplem().checkUserRead(null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckUserWrite() {
+ try {
+ new TopicImplem().checkUserWrite(null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testPermitWritesFromUser() {
+ try {
+ new TopicImplem().permitWritesFromUser("publisherId", null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDenyWritesFromUser() {
+ try {
+ new TopicImplem().denyWritesFromUser("publisherId", null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testPermitReadsByUser() {
+ try {
+ new TopicImplem().permitReadsByUser("consumerId", null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDenyReadsByUser() {
+ try {
+ new TopicImplem().denyReadsByUser("consumerId", null);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.metrics.publisher.CambriaPublisherUtility;\r
-\r
-public class CambriaPublisherUtilityTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testEscape() {\r
- \r
- CambriaPublisherUtility utility = new CambriaPublisherUtility();\r
- \r
- utility.escape("testTopic");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testMakeUrl() {\r
- \r
- CambriaPublisherUtility utility = new CambriaPublisherUtility();\r
- \r
- utility.makeUrl("testTopic");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testMakeConsumerUrl() {\r
- \r
- CambriaPublisherUtility utility = new CambriaPublisherUtility();\r
- \r
- utility.makeConsumerUrl("testTopic", "CG1", "23");\r
- assertTrue(true);\r
- \r
- }\r
-\r
- @Test\r
- public void testCreateHostsList() {\r
- \r
- CambriaPublisherUtility utility = new CambriaPublisherUtility();\r
- \r
- try {\r
- utility.createHostsList(null);\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
-\r
- \r
- }\r
- \r
- @Test\r
- public void testHostForString() {\r
- \r
- CambriaPublisherUtility utility = new CambriaPublisherUtility();\r
- \r
- utility.hostForString("hello");\r
- assertTrue(true);\r
- \r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisherUtility;
+
+public class CambriaPublisherUtilityTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testEscape() {
+
+ CambriaPublisherUtility utility = new CambriaPublisherUtility();
+
+ utility.escape("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testMakeUrl() {
+
+ CambriaPublisherUtility utility = new CambriaPublisherUtility();
+
+ utility.makeUrl("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testMakeConsumerUrl() {
+
+ CambriaPublisherUtility utility = new CambriaPublisherUtility();
+
+ utility.makeConsumerUrl("testTopic", "CG1", "23");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateHostsList() {
+
+ CambriaPublisherUtility utility = new CambriaPublisherUtility();
+
+ try {
+ utility.createHostsList(null);
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+
+ }
+
+ @Test
+ public void testHostForString() {
+
+ CambriaPublisherUtility utility = new CambriaPublisherUtility();
+
+ utility.hostForString("hello");
+ assertTrue(true);
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.listener.DME2EndPointLoader;\r
-import com.att.dmf.mr.metrics.publisher.CambriaConsumer;\r
-import com.att.dmf.mr.metrics.publisher.CambriaPublisherUtility;\r
-import com.att.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;\r
-\r
-public class DMaaPCambriaClientFactoryTest {\r
- \r
- private Collection<String> hostSet;\r
- \r
- private String[] hostSetArray; \r
- @Before\r
- public void setUp() throws Exception {\r
- hostSet = new ArrayList<String>();\r
- \r
- hostSetArray = new String[10];\r
- \r
- for (int i = 0; i < 10; i++) {\r
- hostSet.add("host" + (i+1));\r
- hostSetArray[i] = "host" + (i+1);\r
- }\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer() {\r
- \r
- \r
- \r
- DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer2() {\r
- \r
- \r
- try {\r
- DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic");\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
- \r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer3() {\r
- \r
- DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "filter");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer4() {\r
- DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer5() {\r
- \r
- DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer6() {\r
- \r
- \r
- DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateConsumer7() {\r
- \r
- DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateSimplePublisher() {\r
- \r
- DMaaPCambriaClientFactory.createSimplePublisher("hostList", "testTopic");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateBatchingPublisher() {\r
- \r
- DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateBatchingPublisher2() {\r
- \r
- DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50, true);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateBatchingPublisher3() {\r
- \r
- DMaaPCambriaClientFactory.createBatchingPublisher(hostSetArray, "testTopic", 100, 50, true);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateBatchingPublisher4() {\r
- \r
- DMaaPCambriaClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 50, true);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void $testInject() {\r
- \r
- DMaaPCambriaClientFactory factory = new DMaaPCambriaClientFactory();\r
- factory.$testInject(null);\r
- assertTrue(true);\r
- \r
- }\r
- \r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.listener.DME2EndPointLoader;
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaConsumer;
+import org.onap.dmaap.dmf.mr.metrics.publisher.CambriaPublisherUtility;
+import org.onap.dmaap.dmf.mr.metrics.publisher.DMaaPCambriaClientFactory;
+
+public class DMaaPCambriaClientFactoryTest {
+
+ private Collection<String> hostSet;
+
+ private String[] hostSetArray;
+ @Before
+ public void setUp() throws Exception {
+ hostSet = new ArrayList<String>();
+
+ hostSetArray = new String[10];
+
+ for (int i = 0; i < 10; i++) {
+ hostSet.add("host" + (i+1));
+ hostSetArray[i] = "host" + (i+1);
+ }
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testCreateConsumer() {
+
+
+
+ DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer2() {
+
+
+ try {
+ DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic");
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+
+ }
+
+ @Test
+ public void testCreateConsumer3() {
+
+ DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "filter");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer4() {
+ DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer5() {
+
+ DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer6() {
+
+
+ DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer7() {
+
+ DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateSimplePublisher() {
+
+ DMaaPCambriaClientFactory.createSimplePublisher("hostList", "testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher() {
+
+ DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher2() {
+
+ DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher3() {
+
+ DMaaPCambriaClientFactory.createBatchingPublisher(hostSetArray, "testTopic", 100, 50, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher4() {
+
+ DMaaPCambriaClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 50, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void $testInject() {
+
+ DMaaPCambriaClientFactory factory = new DMaaPCambriaClientFactory();
+ factory.$testInject(null);
+ assertTrue(true);
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPCambriaClientFactoryTest.class, CambriaPublisherUtilityTest.class})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPCambriaClientFactoryTest.class, CambriaPublisherUtilityTest.class})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Collection;\r
-\r
-import com.att.dmf.mr.metrics.publisher.impl.CambriaBaseClient;\r
-import com.att.eelf.configuration.EELFLogger;\r
-\r
-import org.json.JSONArray;\r
-import org.json.JSONObject;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class CambriaBaseClientTest {\r
- \r
- private CambriaBaseClient client = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- Collection<String> hosts = new ArrayList<String>();\r
- \r
- for (int i = 0; i < 5; i++) {\r
- hosts.add("host"+(i+1));\r
- }\r
- \r
- \r
- client = new CambriaBaseClient(hosts, "client1");\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testClose() {\r
- client.close();\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGetLog() {\r
- client.getLog();\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testLogTo() {\r
- client.logTo(null);\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- public JSONArray getJSONArray() {\r
- \r
- String[] data = {"stringone", "stringtwo"};\r
- JSONArray array = new JSONArray(Arrays.asList(data));\r
-\r
- return array;\r
- }\r
- \r
- @Test\r
- public void testJsonArrayToSet() {\r
- client.jsonArrayToSet(getJSONArray());\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.CambriaBaseClient;
+import com.att.eelf.configuration.EELFLogger;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CambriaBaseClientTest {
+
+ private CambriaBaseClient client = null;
+ @Before
+ public void setUp() throws Exception {
+
+ Collection<String> hosts = new ArrayList<String>();
+
+ for (int i = 0; i < 5; i++) {
+ hosts.add("host"+(i+1));
+ }
+
+
+ client = new CambriaBaseClient(hosts, "client1");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testClose() {
+ client.close();
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetLog() {
+ client.getLog();
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testLogTo() {
+ client.logTo(null);
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ public JSONArray getJSONArray() {
+
+ String[] data = {"stringone", "stringtwo"};
+ JSONArray array = new JSONArray(Arrays.asList(data));
+
+ return array;
+ }
+
+ @Test
+ public void testJsonArrayToSet() {
+ client.jsonArrayToSet(getJSONArray());
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.metrics.publisher.impl.Clock;\r
-\r
-public class ClockTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetIt() {\r
- \r
- Clock.getIt();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testNow() {\r
- \r
- Clock.now();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testNowImpl() {\r
- \r
- Clock clock = new Clock();\r
- clock.nowImpl();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testRegister() {\r
- \r
- Clock clock = new Clock();\r
- Clock.register(clock);\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import static org.junit.Assert.*;
+
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.Clock;
+
+public class ClockTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetIt() {
+
+ Clock.getIt();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testNow() {
+
+ Clock.now();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testNowImpl() {
+
+ Clock clock = new Clock();
+ clock.nowImpl();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testRegister() {
+
+ Clock clock = new Clock();
+ Clock.register(clock);
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.List;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.metrics.publisher.impl.DMaaPCambriaConsumerImpl;\r
-\r
-public class DMaaPCambriaConsumerImplTest {\r
- \r
- private DMaaPCambriaConsumerImpl consumer = null; \r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- Collection<String> hosts = new ArrayList<String>();\r
- \r
- for (int i = 0; i < 5; i++) {\r
- hosts.add("host"+(i+1));\r
- }\r
- consumer = new DMaaPCambriaConsumerImpl(hosts, "testTopic", "consumerGroup1", "1", 2000, 200, "hi", \r
- "9AMFFNIZpusO54oG","6BY86UQcio2LJdgyU7Cwg5oQ");\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testStringToList() {\r
- \r
- List<String> response = DMaaPCambriaConsumerImpl.stringToList("Hello world, this is a test string");\r
- assertNotNull(response);\r
- \r
- \r
- }\r
- \r
- @Test\r
- public void testFetch() {\r
- \r
- Iterable<String> response = null;\r
- boolean flag = true;\r
- try {\r
- response = consumer.fetch(200, 20);\r
- } catch (IOException e) {\r
- flag = false;\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- if(flag) {\r
- assertNotNull(response);\r
- } else {\r
- assertTrue(true);\r
- }\r
- \r
- }\r
- \r
- \r
- @Test\r
- public void testCreateUrlPath() {\r
- \r
- String response = consumer.createUrlPath(200, 20);\r
- assertNotNull(response);\r
- }\r
-\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.DMaaPCambriaConsumerImpl;
+
+public class DMaaPCambriaConsumerImplTest {
+
+ private DMaaPCambriaConsumerImpl consumer = null;
+ @Before
+ public void setUp() throws Exception {
+
+ Collection<String> hosts = new ArrayList<String>();
+
+ for (int i = 0; i < 5; i++) {
+ hosts.add("host"+(i+1));
+ }
+ consumer = new DMaaPCambriaConsumerImpl(hosts, "testTopic", "consumerGroup1", "1", 2000, 200, "hi",
+ "9AMFFNIZpusO54oG","6BY86UQcio2LJdgyU7Cwg5oQ");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testStringToList() {
+
+ List<String> response = DMaaPCambriaConsumerImpl.stringToList("Hello world, this is a test string");
+ assertNotNull(response);
+
+
+ }
+
+ @Test
+ public void testFetch() {
+
+ Iterable<String> response = null;
+ boolean flag = true;
+ try {
+ response = consumer.fetch(200, 20);
+ } catch (IOException e) {
+ flag = false;
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(flag) {
+ assertNotNull(response);
+ } else {
+ assertTrue(true);
+ }
+
+ }
+
+
+ @Test
+ public void testCreateUrlPath() {
+
+ String response = consumer.createUrlPath(200, 20);
+ assertNotNull(response);
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.metrics.publisher.impl.DMaaPCambriaSimplerBatchPublisher;\r
-\r
-\r
-\r
-public class DMaaPCambriaSimplerBatchPublisherTest {\r
- \r
- private DMaaPCambriaSimplerBatchPublisher publisher = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- Collection<String> hosts = new ArrayList<String>();\r
- \r
- for (int i = 0; i < 5; i++) {\r
- hosts.add("host"+(i+1));\r
- }\r
- \r
- publisher = new DMaaPCambriaSimplerBatchPublisher.Builder().againstUrls(hosts).onTopic("testTopic")\r
- .batchTo(200, 100).compress(true).build(); \r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSend() {\r
- \r
- publisher.send("hello", "test message");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testClose() {\r
- \r
- publisher.close();\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- @Test\r
- public void testGetPendingMEssageCount() {\r
- \r
- publisher.getPendingMessageCount();\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.metrics.publisher.impl.DMaaPCambriaSimplerBatchPublisher;
+
+
+
+public class DMaaPCambriaSimplerBatchPublisherTest {
+
+ private DMaaPCambriaSimplerBatchPublisher publisher = null;
+ @Before
+ public void setUp() throws Exception {
+
+ Collection<String> hosts = new ArrayList<String>();
+
+ for (int i = 0; i < 5; i++) {
+ hosts.add("host"+(i+1));
+ }
+
+ publisher = new DMaaPCambriaSimplerBatchPublisher.Builder().againstUrls(hosts).onTopic("testTopic")
+ .batchTo(200, 100).compress(true).build();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSend() {
+
+ publisher.send("hello", "test message");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testClose() {
+
+ publisher.close();
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+ @Test
+ public void testGetPendingMEssageCount() {
+
+ publisher.getPendingMessageCount();
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.metrics.publisher.impl;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPCambriaSimplerBatchPublisherTest.class, ClockTest.class,\r
- CambriaBaseClientTest.class, DMaaPCambriaConsumerImplTest.class})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPCambriaSimplerBatchPublisherTest.class, ClockTest.class,
+ CambriaBaseClientTest.class, DMaaPCambriaConsumerImplTest.class})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.resources.CambriaEventSet;\r
-import com.att.dmf.mr.resources.CambriaOutboundEventStream;\r
-\r
-\r
-public class CambriaEventSetTest {\r
-\r
- private CambriaOutboundEventStream coes = null;\r
- \r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testNext() {\r
- CambriaEventSet event = null;\r
- String str = "contains text to be converted to InputStream";\r
- \r
- InputStream stream = new ByteArrayInputStream(str.getBytes());\r
- try {\r
- event = new CambriaEventSet("application/cambria", stream, true, "hi");\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- try {\r
- event.next();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.resources.CambriaEventSet;
+import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream;
+
+
+public class CambriaEventSetTest {
+
+ private CambriaOutboundEventStream coes = null;
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testNext() {
+ CambriaEventSet event = null;
+ String str = "contains text to be converted to InputStream";
+
+ InputStream stream = new ByteArrayInputStream(str.getBytes());
+ try {
+ event = new CambriaEventSet("application/cambria", stream, true, "hi");
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ event.next();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.resources.CambriaOutboundEventStream;\r
-\r
-public class CambriaOutboundEventStreamTest {\r
-\r
- private CambriaOutboundEventStream coes = null;\r
- \r
- @Before\r
- public void setUp() throws Exception {\r
- coes = new CambriaOutboundEventStream.Builder(null).timeout(10).limit(1).filter(CambriaConstants.kNoFilter)\r
- .pretty(false).withMeta(true).build();\r
- DMaaPContext ctx = new DMaaPContext();\r
- //ctx.set...\r
- coes.setDmaapContext(ctx);\r
- coes.setTopic(null);\r
- coes.setTransEnabled(true);\r
- coes.setTopicStyle(true);\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetSentCount() {\r
- int sentCount = coes.getSentCount();\r
- assertTrue("Doesn't match, got " + sentCount, sentCount==0);;\r
- }\r
-\r
- @Test\r
- public void testWrite() {\r
- //fail("Not yet implemented");\r
- }\r
-\r
- @Test\r
- public void testForEachMessage() {\r
- //fail("Not yet implemented");\r
- }\r
-\r
- @Test\r
- public void testGetDmaapContext() {\r
- DMaaPContext ctx = coes.getDmaapContext();\r
- \r
- assertNotNull(ctx);\r
- }\r
-\r
- @Test\r
- public void testSetDmaapContext() {\r
- DMaaPContext ctx = new DMaaPContext();\r
- coes.setDmaapContext(ctx);\r
- assertTrue(ctx.equals(coes.getDmaapContext()));\r
- }\r
-\r
- @Test\r
- public void testGetTopic() {\r
- coes.getTopic();\r
- assertTrue(true);\r
- }\r
-\r
- @Test\r
- public void testSetTopic() {\r
- //fail("Not yet implemented");\r
- }\r
-\r
- @Test\r
- public void testSetTopicStyle() {\r
- coes.setTopicStyle(true);\r
- assertTrue(true);\r
- }\r
-\r
- @Test\r
- public void testSetTransEnabled() {\r
- coes.setTransEnabled(true);\r
- assertTrue(true);\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.resources.CambriaOutboundEventStream;
+
+public class CambriaOutboundEventStreamTest {
+
+ private CambriaOutboundEventStream coes = null;
+
+ @Before
+ public void setUp() throws Exception {
+ coes = new CambriaOutboundEventStream.Builder(null).timeout(10).limit(1).filter(CambriaConstants.kNoFilter)
+ .pretty(false).withMeta(true).build();
+ DMaaPContext ctx = new DMaaPContext();
+ //ctx.set...
+ coes.setDmaapContext(ctx);
+ coes.setTopic(null);
+ coes.setTransEnabled(true);
+ coes.setTopicStyle(true);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetSentCount() {
+ int sentCount = coes.getSentCount();
+ assertTrue("Doesn't match, got " + sentCount, sentCount==0);;
+ }
+
+ @Test
+ public void testWrite() {
+ //fail("Not yet implemented");
+ }
+
+ @Test
+ public void testForEachMessage() {
+ //fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetDmaapContext() {
+ DMaaPContext ctx = coes.getDmaapContext();
+
+ assertNotNull(ctx);
+ }
+
+ @Test
+ public void testSetDmaapContext() {
+ DMaaPContext ctx = new DMaaPContext();
+ coes.setDmaapContext(ctx);
+ assertTrue(ctx.equals(coes.getDmaapContext()));
+ }
+
+ @Test
+ public void testGetTopic() {
+ coes.getTopic();
+ assertTrue(true);
+ }
+
+ @Test
+ public void testSetTopic() {
+ //fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetTopicStyle() {
+ coes.setTopicStyle(true);
+ assertTrue(true);
+ }
+
+ @Test
+ public void testSetTransEnabled() {
+ coes.setTransEnabled(true);
+ assertTrue(true);
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ CambriaEventSetTest.class,CambriaOutboundEventStreamTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ CambriaEventSetTest.class,CambriaOutboundEventStreamTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.dmf.mr.resources.streamReaders.CambriaJsonStreamReader;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-\r
-public class CambriaJsonStreamReaderTest {\r
- \r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- \r
- @Test\r
- public void testNext() {\r
- \r
- CambriaJsonStreamReader test = null;\r
- \r
- String source = "{'name': 'tester', 'id': '2'}";\r
- InputStream stream = null;\r
- try {\r
- stream = IOUtils.toInputStream(source, "UTF-8");\r
- test = new CambriaJsonStreamReader(stream,"hello");\r
- test.next();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (CambriaApiException e1) {\r
- e1.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaJsonStreamReader;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+
+public class CambriaJsonStreamReaderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testNext() {
+
+ CambriaJsonStreamReader test = null;
+
+ String source = "{'name': 'tester', 'id': '2'}";
+ InputStream stream = null;
+ try {
+ stream = IOUtils.toInputStream(source, "UTF-8");
+ test = new CambriaJsonStreamReader(stream,"hello");
+ test.next();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (CambriaApiException e1) {
+ e1.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.dmf.mr.resources.streamReaders.CambriaRawStreamReader;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-\r
-public class CambriaRawStreamReaderTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testNext() {\r
- \r
- CambriaRawStreamReader test = null;\r
- message msg = null;\r
-\r
- String source = "{'name': 'tester', 'id': '2'}";\r
- InputStream stream = null;\r
- try {\r
- stream = IOUtils.toInputStream(source, "UTF-8");\r
- test = new CambriaRawStreamReader(stream,"hello");\r
- msg = test.next();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (CambriaApiException e1) {\r
- e1.printStackTrace();\r
- }\r
- \r
- assertNotNull(msg);\r
- \r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaRawStreamReader;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+
+public class CambriaRawStreamReaderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testNext() {
+
+ CambriaRawStreamReader test = null;
+ message msg = null;
+
+ String source = "{'name': 'tester', 'id': '2'}";
+ InputStream stream = null;
+ try {
+ stream = IOUtils.toInputStream(source, "UTF-8");
+ test = new CambriaRawStreamReader(stream,"hello");
+ msg = test.next();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (CambriaApiException e1) {
+ e1.printStackTrace();
+ }
+
+ assertNotNull(msg);
+
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.dmf.mr.resources.streamReaders.CambriaStreamReader;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-\r
-public class CambriaStreamReaderTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testNext() {\r
- \r
- CambriaStreamReader test = null;\r
- \r
-\r
- String source = "{'name': 'tester', 'id': '2', 'message': 'hello'}";\r
- InputStream stream = null;\r
- try {\r
- stream = IOUtils.toInputStream(source, "UTF-8");\r
- test = new CambriaStreamReader(stream);\r
- test.next();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (CambriaApiException e1) {\r
- e1.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaStreamReader;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+
+public class CambriaStreamReaderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testNext() {
+
+ CambriaStreamReader test = null;
+
+
+ String source = "{'name': 'tester', 'id': '2', 'message': 'hello'}";
+ InputStream stream = null;
+ try {
+ stream = IOUtils.toInputStream(source, "UTF-8");
+ test = new CambriaStreamReader(stream);
+ test.next();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (CambriaApiException e1) {
+ e1.printStackTrace();
+ }
+
+ assertTrue(true);
+
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.dmf.mr.resources.streamReaders.CambriaStreamReader;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-\r
-public class CambriaTextStreamReaderTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testNext() {\r
- \r
- CambriaStreamReader test = null;\r
- \r
- String source = "{'name': 'tester', 'id': '2', 'message': 'hello'}";\r
- InputStream stream = null;\r
- try {\r
- stream = IOUtils.toInputStream(source, "UTF-8");\r
- test = new CambriaStreamReader(stream);\r
- test.next();\r
- } catch (IOException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- } catch (CambriaApiException e1) {\r
- e1.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.resources.streamReaders.CambriaStreamReader;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+
+public class CambriaTextStreamReaderTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testNext() {
+
+ CambriaStreamReader test = null;
+
+ String source = "{'name': 'tester', 'id': '2', 'message': 'hello'}";
+ InputStream stream = null;
+ try {
+ stream = IOUtils.toInputStream(source, "UTF-8");
+ test = new CambriaStreamReader(stream);
+ test.next();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (CambriaApiException e1) {
+ e1.printStackTrace();
+ }
+
+ assertTrue(true);
+
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.resources.streamReaders;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ CambriaJsonStreamReaderTest.class,CambriaRawStreamReaderTest.class, \r
- CambriaStreamReaderTest.class, CambriaTextStreamReaderTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ CambriaJsonStreamReaderTest.class,CambriaRawStreamReaderTest.class,
+ CambriaStreamReaderTest.class, CambriaTextStreamReaderTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.resources.streamReaders;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.security.DMaaPAAFAuthenticatorImpl;\r
-\r
-\r
-\r
-public class DMaaPAAFAuthenticatorImplTest {\r
- \r
- private MockHttpServletRequest request = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- //creating servlet object\r
- request = new MockHttpServletRequest();\r
- request.setServerName("www.example.com");\r
- request.setRequestURI("/foo");\r
- request.setQueryString("param1=value1¶m");\r
- String url = request.getRequestURL() + "?" + request.getQueryString(); \r
-\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testAafAuthentication() {\r
- \r
- DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();\r
- authenticator.aafAuthentication(request, "admin");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- \r
- /*@Test\r
- public void testAafPermissionString() {\r
- \r
- DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();\r
- try {\r
- authenticator.aafPermissionString("testTopic", "admin");\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- }*/\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
+
+
+
+public class DMaaPAAFAuthenticatorImplTest {
+
+ private MockHttpServletRequest request = null;
+ @Before
+ public void setUp() throws Exception {
+ //creating servlet object
+ request = new MockHttpServletRequest();
+ request.setServerName("www.example.com");
+ request.setRequestURI("/foo");
+ request.setQueryString("param1=value1¶m");
+ String url = request.getRequestURL() + "?" + request.getQueryString();
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testAafAuthentication() {
+
+ DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();
+ authenticator.aafAuthentication(request, "admin");
+ assertTrue(true);
+
+ }
+
+
+
+ /*@Test
+ public void testAafPermissionString() {
+
+ DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();
+ try {
+ authenticator.aafPermissionString("testTopic", "admin");
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }*/
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-\r
-\r
-\r
-public class DMaaPAuthenticatorImplTest {\r
- \r
- private MockHttpServletRequest request = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- //creating servlet object\r
- request = new MockHttpServletRequest();\r
- request.setServerName("www.example.com");\r
- request.setRequestURI("/foo");\r
- request.setQueryString("param1=value1¶m");\r
- String url = request.getRequestURL() + "?" + request.getQueryString(); \r
-\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- /*@Test\r
- public void testAuthenticate() {\r
- \r
- DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);\r
- \r
- DMaaPContext ctx = new DMaaPContext();\r
- authenticator.authenticate(ctx);\r
- assertTrue(true);\r
- \r
- }*/\r
- \r
- \r
- \r
- /*@Test\r
- public void testAafPermissionString() {\r
- \r
- DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();\r
- try {\r
- authenticator.aafPermissionString("testTopic", "admin");\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- assertTrue(true);\r
- \r
- }*/\r
- \r
- @Test\r
- public void testIsAuthentic() {\r
- \r
- DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);\r
- \r
- authenticator.isAuthentic(request);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testQualify() {\r
- \r
- DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);\r
- \r
- authenticator.qualify(request);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testAddAuthenticator() {\r
- \r
- DMaaPAuthenticatorImpl authenticator = new DMaaPAuthenticatorImpl(null);\r
- DMaaPAuthenticator authenticator2 = new DMaaPAuthenticatorImpl(null);\r
- \r
- authenticator.addAuthenticator(authenticator2);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- /*@Test\r
- public void testGetAuthenticatedUser() {\r
- \r
- \r
- DMaaPContext ctx = new DMaaPContext();\r
- DMaaPAuthenticatorImpl.getAuthenticatedUser(ctx);\r
- assertTrue(true);\r
- \r
- }\r
- */\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+
+
+
+public class DMaaPAuthenticatorImplTest {
+
+ private MockHttpServletRequest request = null;
+ @Before
+ public void setUp() throws Exception {
+ //creating servlet object
+ request = new MockHttpServletRequest();
+ request.setServerName("www.example.com");
+ request.setRequestURI("/foo");
+ request.setQueryString("param1=value1¶m");
+ String url = request.getRequestURL() + "?" + request.getQueryString();
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /*@Test
+ public void testAuthenticate() {
+
+ DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);
+
+ DMaaPContext ctx = new DMaaPContext();
+ authenticator.authenticate(ctx);
+ assertTrue(true);
+
+ }*/
+
+
+
+ /*@Test
+ public void testAafPermissionString() {
+
+ DMaaPAAFAuthenticatorImpl authenticator = new DMaaPAAFAuthenticatorImpl();
+ try {
+ authenticator.aafPermissionString("testTopic", "admin");
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }*/
+
+ @Test
+ public void testIsAuthentic() {
+
+ DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);
+
+ authenticator.isAuthentic(request);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testQualify() {
+
+ DMaaPAuthenticatorImpl<?> authenticator = new DMaaPAuthenticatorImpl(null);
+
+ authenticator.qualify(request);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddAuthenticator() {
+
+ DMaaPAuthenticatorImpl authenticator = new DMaaPAuthenticatorImpl(null);
+ DMaaPAuthenticator authenticator2 = new DMaaPAuthenticatorImpl(null);
+
+ authenticator.addAuthenticator(authenticator2);
+ assertTrue(true);
+
+ }
+
+ /*@Test
+ public void testGetAuthenticatedUser() {
+
+
+ DMaaPContext ctx = new DMaaPContext();
+ DMaaPAuthenticatorImpl.getAuthenticatedUser(ctx);
+ assertTrue(true);
+
+ }
+ */
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPAAFAuthenticatorImplTest.class,DMaaPAuthenticatorImplTest.class, \r
-})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPAAFAuthenticatorImplTest.class,DMaaPAuthenticatorImplTest.class,
+})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.security.impl.DMaaPMechIdAuthenticator;\r
-\r
-\r
-\r
-public class DMaaPMechIdAuthenticatorTest {\r
- \r
- private MockHttpServletRequest request = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- //creating servlet object\r
- request = new MockHttpServletRequest();\r
- request.setServerName("www.example.com");\r
- request.setRequestURI("/foo");\r
- request.setQueryString("param1=value1¶m");\r
- String url = request.getRequestURL() + "?" + request.getQueryString(); \r
-\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- \r
- @Test\r
- public void testQualify() {\r
- \r
- DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
- \r
- authenticator.qualify(request);\r
- assertTrue(true);\r
- \r
- } \r
- \r
- @Test\r
- public void testAuthenticate() {\r
- \r
- DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
- \r
- DMaaPContext ctx = new DMaaPContext();\r
- authenticator.authenticate(ctx);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testIsAuthentic() {\r
- DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
- \r
- authenticator.isAuthentic(request);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- \r
- @Test\r
- public void testAddAuthenticator() {\r
- \r
- DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();\r
- DMaaPMechIdAuthenticator authenticator2 = new DMaaPMechIdAuthenticator();\r
- \r
- authenticator.addAuthenticator(authenticator2);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security.impl;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.security.impl.DMaaPMechIdAuthenticator;
+
+
+
+public class DMaaPMechIdAuthenticatorTest {
+
+ private MockHttpServletRequest request = null;
+ @Before
+ public void setUp() throws Exception {
+ //creating servlet object
+ request = new MockHttpServletRequest();
+ request.setServerName("www.example.com");
+ request.setRequestURI("/foo");
+ request.setQueryString("param1=value1¶m");
+ String url = request.getRequestURL() + "?" + request.getQueryString();
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testQualify() {
+
+ DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();
+
+ authenticator.qualify(request);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAuthenticate() {
+
+ DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();
+
+ DMaaPContext ctx = new DMaaPContext();
+ authenticator.authenticate(ctx);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testIsAuthentic() {
+ DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();
+
+ authenticator.isAuthentic(request);
+ assertTrue(true);
+
+ }
+
+
+
+ @Test
+ public void testAddAuthenticator() {
+
+ DMaaPMechIdAuthenticator authenticator = new DMaaPMechIdAuthenticator();
+ DMaaPMechIdAuthenticator authenticator2 = new DMaaPMechIdAuthenticator();
+
+ authenticator.addAuthenticator(authenticator2);
+ assertTrue(true);
+
+ }
+
+
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;\r
-\r
-\r
-\r
-public class DMaaPOriginalUebAuthenticatorTest {\r
- \r
- private MockHttpServletRequest request = null;\r
- @Before\r
- public void setUp() throws Exception {\r
- //creating servlet object\r
- request = new MockHttpServletRequest();\r
- request.setServerName("www.example.com");\r
- request.setRequestURI("/foo");\r
- request.setQueryString("param1=value1¶m");\r
- String url = request.getRequestURL() + "?" + request.getQueryString(); \r
-\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- \r
- @Test\r
- public void testQualify() {\r
- \r
- DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);\r
- \r
- authenticator.qualify(request);\r
- assertTrue(true);\r
- \r
- } \r
- \r
- @Test\r
- public void testAuthenticate() {\r
- \r
- DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);\r
- \r
- DMaaPContext ctx = new DMaaPContext();\r
- authenticator.authenticate(ctx);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testAuthenticate2() {\r
- \r
- DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);\r
- DMaaPContext ctx = new DMaaPContext();\r
- authenticator.authenticate("google.com", "xHMDwk25kwkkyi26JH","Dec 16, 2016", "Dec/16/2016","123");\r
- \r
- \r
- }\r
- \r
- @Test\r
- public void testIsAuthentic() {\r
- DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);\r
- \r
- authenticator.isAuthentic(request);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- \r
- @Test\r
- public void testAddAuthenticator() {\r
- \r
- DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);\r
- DMaaPOriginalUebAuthenticator authenticator2 = new DMaaPOriginalUebAuthenticator(null, 100);\r
- \r
- authenticator.addAuthenticator(authenticator2);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security.impl;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.security.impl.DMaaPOriginalUebAuthenticator;
+
+
+
+public class DMaaPOriginalUebAuthenticatorTest {
+
+ private MockHttpServletRequest request = null;
+ @Before
+ public void setUp() throws Exception {
+ //creating servlet object
+ request = new MockHttpServletRequest();
+ request.setServerName("www.example.com");
+ request.setRequestURI("/foo");
+ request.setQueryString("param1=value1¶m");
+ String url = request.getRequestURL() + "?" + request.getQueryString();
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testQualify() {
+
+ DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);
+
+ authenticator.qualify(request);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAuthenticate() {
+
+ DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);
+
+ DMaaPContext ctx = new DMaaPContext();
+ authenticator.authenticate(ctx);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAuthenticate2() {
+
+ DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);
+ DMaaPContext ctx = new DMaaPContext();
+ authenticator.authenticate("google.com", "xHMDwk25kwkkyi26JH","Dec 16, 2016", "Dec/16/2016","123");
+
+
+ }
+
+ @Test
+ public void testIsAuthentic() {
+ DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);
+
+ authenticator.isAuthentic(request);
+ assertTrue(true);
+
+ }
+
+
+
+ @Test
+ public void testAddAuthenticator() {
+
+ DMaaPOriginalUebAuthenticator authenticator = new DMaaPOriginalUebAuthenticator(null, 100);
+ DMaaPOriginalUebAuthenticator authenticator2 = new DMaaPOriginalUebAuthenticator(null, 100);
+
+ authenticator.addAuthenticator(authenticator2);
+ assertTrue(true);
+
+ }
+
+
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.security.impl;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPMechIdAuthenticatorTest.class, DMaaPOriginalUebAuthenticatorTest.class, \r
-})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security.impl;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPMechIdAuthenticatorTest.class, DMaaPOriginalUebAuthenticatorTest.class,
+})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.security.impl;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import com.att.dmf.mr.backends.ConsumerFactory;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.service.impl.AdminServiceImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.limits.Blacklist;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })\r
-public class AdminServiceImplemTest {\r
-\r
- @InjectMocks\r
- AdminServiceImpl adminServiceImpl;\r
-\r
- @Mock\r
- DMaaPContext dmaapContext;\r
- @Mock\r
- ConsumerFactory factory;\r
-\r
- @Mock\r
- ConfigurationReader configReader;\r
- @Mock\r
- Blacklist Blacklist;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);\r
- NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");\r
-\r
- PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);\r
- PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);\r
-\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- // ISSUES WITH AUTHENTICATION\r
- @Test\r
- public void testShowConsumerCache() {\r
-\r
- try {\r
- adminServiceImpl.showConsumerCache(dmaapContext);\r
- } catch (IOException | AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
- @Test\r
- public void testDropConsumerCache() {\r
-\r
- try {\r
- adminServiceImpl.dropConsumerCache(dmaapContext);\r
- } catch (IOException | AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
- @Test\r
- public void testGetBlacklist() {\r
-\r
- try {\r
- adminServiceImpl.getBlacklist(dmaapContext);\r
- } catch (IOException | AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
- @Test\r
- public void testAddToBlacklist() {\r
-\r
- try {\r
- adminServiceImpl.addToBlacklist(dmaapContext, "120.120.120.120");\r
- } catch (IOException | AccessDeniedException | ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
- @Test\r
- public void testRemoveFromBlacklist() {\r
-\r
- try {\r
- adminServiceImpl.removeFromBlacklist(dmaapContext, "120.120.120.120");\r
- } catch (IOException | AccessDeniedException | ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
-}\r
+/*-
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.impl.AdminServiceImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.limits.Blacklist;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
+public class AdminServiceImplemTest {
+
+ @InjectMocks
+ AdminServiceImpl adminServiceImpl;
+
+ @Mock
+ DMaaPContext dmaapContext;
+ @Mock
+ ConsumerFactory factory;
+
+ @Mock
+ ConfigurationReader configReader;
+ @Mock
+ Blacklist Blacklist;
+
+ @Before
+ public void setUp() throws Exception {
+
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+ NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+ PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+ PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ // ISSUES WITH AUTHENTICATION
+ @Test
+ public void testShowConsumerCache() {
+
+ try {
+ adminServiceImpl.showConsumerCache(dmaapContext);
+ } catch (IOException | AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testDropConsumerCache() {
+
+ try {
+ adminServiceImpl.dropConsumerCache(dmaapContext);
+ } catch (IOException | AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetBlacklist() {
+
+ try {
+ adminServiceImpl.getBlacklist(dmaapContext);
+ } catch (IOException | AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testAddToBlacklist() {
+
+ try {
+ adminServiceImpl.addToBlacklist(dmaapContext, "120.120.120.120");
+ } catch (IOException | AccessDeniedException | ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testRemoveFromBlacklist() {
+
+ try {
+ adminServiceImpl.removeFromBlacklist(dmaapContext, "120.120.120.120");
+ } catch (IOException | AccessDeniedException | ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-import java.util.Arrays;\r
-import java.util.HashSet;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import com.att.dmf.mr.backends.ConsumerFactory;\r
-import com.att.dmf.mr.beans.ApiKeyBean;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.service.impl.ApiKeysServiceImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.dmf.mr.utils.Emailer;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.limits.Blacklist;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-import com.att.nsa.security.db.NsaApiDb;\r
-import com.att.nsa.security.db.NsaApiDb.KeyExistsException;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })\r
-public class ApiKeysServiceImplTest {\r
- \r
- @InjectMocks\r
- ApiKeysServiceImpl service;\r
-\r
- @Mock\r
- DMaaPContext dmaapContext;\r
- @Mock\r
- ConsumerFactory factory;\r
-\r
- @Mock\r
- ConfigurationReader configReader;\r
- @Mock\r
- Blacklist Blacklist;\r
- @Mock\r
- Emailer emailer;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);\r
- NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");\r
-\r
- PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);\r
- PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);\r
- \r
- PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);\r
- PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- \r
- @Test\r
- public void testGetAllApiKeys() {\r
- \r
- service = new ApiKeysServiceImpl();\r
- try {\r
- service.getAllApiKeys(dmaapContext);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- \r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetApiKey() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- service.getApiKey(dmaapContext, "testkey");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- }\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetApiKey_error() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- service.getApiKey(dmaapContext, "k35Hdw6Sde");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- }\r
- \r
- @Test\r
- public void testCreateApiKey() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- service.createApiKey(dmaapContext, new ApiKeyBean("test@onap.com", "testing apikey bean"));\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (KeyExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch(NoClassDefFoundError e) {\r
- \r
- }\r
- assertTrue(true);\r
- }\r
- \r
- @Test\r
- public void testUpdateApiKey() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- \r
- service.updateApiKey(dmaapContext, "admin", new ApiKeyBean("test@onapt.com", "testing apikey bean"));\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
- \r
- }\r
- @Test\r
- public void testUpdateApiKey_error() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- \r
- service.updateApiKey(dmaapContext, null, new ApiKeyBean("test@onapt.com", "testing apikey bean"));\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- }\r
- \r
- @Test\r
- public void testDeleteApiKey() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- \r
- service.deleteApiKey(dmaapContext, null);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- }\r
- \r
- @Test\r
- public void testDeleteApiKey_error() {\r
- \r
- ApiKeysServiceImpl service = new ApiKeysServiceImpl();\r
- try {\r
- \r
- service.deleteApiKey(dmaapContext, "admin");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- \r
- }\r
- \r
- NsaApiDb<NsaSimpleApiKey> fApiKeyDb= new NsaApiDb<NsaSimpleApiKey>() {\r
- \r
- \r
- Set<String> keys = new HashSet<>(Arrays.asList("testkey","admin"));\r
- \r
- \r
- @Override\r
- public NsaSimpleApiKey createApiKey(String arg0, String arg1)\r
- throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return new NsaSimpleApiKey(arg0, arg1);\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(String arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Set<String> loadAllKeys() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- \r
- return keys ;\r
- }\r
-\r
- @Override\r
- public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {\r
- if(!keys.contains(arg0)){\r
- return null;\r
- }\r
- return new NsaSimpleApiKey(arg0, "password");\r
- }\r
-\r
- @Override\r
- public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
- };\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.ApiKeyBean;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.impl.ApiKeysServiceImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Emailer;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.limits.Blacklist;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.NsaApiDb;
+import com.att.nsa.security.db.NsaApiDb.KeyExistsException;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
+public class ApiKeysServiceImplTest {
+
+ @InjectMocks
+ ApiKeysServiceImpl service;
+
+ @Mock
+ DMaaPContext dmaapContext;
+ @Mock
+ ConsumerFactory factory;
+
+ @Mock
+ ConfigurationReader configReader;
+ @Mock
+ Blacklist Blacklist;
+ @Mock
+ Emailer emailer;
+
+ @Before
+ public void setUp() throws Exception {
+
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+ NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+ PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+ PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+
+ PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+ PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+ @Test
+ public void testGetAllApiKeys() {
+
+ service = new ApiKeysServiceImpl();
+ try {
+ service.getAllApiKeys(dmaapContext);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetApiKey() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+ service.getApiKey(dmaapContext, "testkey");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetApiKey_error() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+ service.getApiKey(dmaapContext, "k35Hdw6Sde");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testCreateApiKey() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+ service.createApiKey(dmaapContext, new ApiKeyBean("test@onap.com", "testing apikey bean"));
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (KeyExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch(NoClassDefFoundError e) {
+
+ }
+ assertTrue(true);
+ }
+
+ @Test
+ public void testUpdateApiKey() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+
+ service.updateApiKey(dmaapContext, "admin", new ApiKeyBean("test@onapt.com", "testing apikey bean"));
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+ @Test
+ public void testUpdateApiKey_error() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+
+ service.updateApiKey(dmaapContext, null, new ApiKeyBean("test@onapt.com", "testing apikey bean"));
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testDeleteApiKey() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+
+ service.deleteApiKey(dmaapContext, null);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testDeleteApiKey_error() {
+
+ ApiKeysServiceImpl service = new ApiKeysServiceImpl();
+ try {
+
+ service.deleteApiKey(dmaapContext, "admin");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ NsaApiDb<NsaSimpleApiKey> fApiKeyDb= new NsaApiDb<NsaSimpleApiKey>() {
+
+
+ Set<String> keys = new HashSet<>(Arrays.asList("testkey","admin"));
+
+
+ @Override
+ public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+ throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+ // TODO Auto-generated method stub
+ return new NsaSimpleApiKey(arg0, arg1);
+ }
+
+ @Override
+ public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean deleteApiKey(String arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<String> loadAllKeys() throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ return keys ;
+ }
+
+ @Override
+ public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+ if(!keys.contains(arg0)){
+ return null;
+ }
+ return new NsaSimpleApiKey(arg0, "password");
+ }
+
+ @Override
+ public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ }
+ };
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.dmf.mr.service.impl.BaseTransactionDbImpl;\r
-import com.att.dmf.mr.transaction.DMaaPTransactionObjDB.KeyExistsException;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class BaseTransactionDbImplTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- @Test\r
- public void testCreateTransactionObj() {\r
- \r
- \r
- try {\r
- \r
- BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);\r
- service.createTransactionObj("transition");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (KeyExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testSaveTransactionObj() {\r
- \r
- \r
- try {\r
- \r
- BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);\r
- service.saveTransactionObj(null);\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testLoadTransactionObj() {\r
- \r
- try {\r
- \r
- BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);\r
- service.loadTransactionObj("34");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
-\r
- @Test\r
- public void testLoadAllTransactionObjs() {\r
- \r
- try {\r
- \r
- BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);\r
- service.loadAllTransactionObjs();\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
-\r
-\r
- \r
- \r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.service.impl.BaseTransactionDbImpl;
+import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObjDB.KeyExistsException;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BaseTransactionDbImplTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testCreateTransactionObj() {
+
+
+ try {
+
+ BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
+ service.createTransactionObj("transition");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (KeyExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testSaveTransactionObj() {
+
+
+ try {
+
+ BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
+ service.saveTransactionObj(null);
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testLoadTransactionObj() {
+
+ try {
+
+ BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
+ service.loadTransactionObj("34");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+ @Test
+ public void testLoadAllTransactionObjs() {
+
+ try {
+
+ BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
+ service.loadAllTransactionObjs();
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.mockito.Mockito.when;\r
-import static org.mockito.Matchers.anyString;\r
-import static org.junit.Assert.assertFalse;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ConcurrentModificationException;\r
-import java.util.Map;\r
-import java.util.Properties;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-import org.springframework.mock.web.MockHttpServletResponse;\r
-\r
-import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.security.DMaaPAAFAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;\r
-import com.att.dmf.mr.beans.DMaaPCambriaLimiter;\r
-import com.att.dmf.mr.backends.ConsumerFactory;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.exception.DMaaPAccessDeniedException;\r
-import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.dmf.mr.service.impl.EventsServiceImpl;\r
-import com.att.dmf.mr.utils.PropertyReader;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.invalidSettingValue;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;\r
-import com.att.nsa.limits.Blacklist;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-import com.att.nsa.security.NsaApiKey;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import kafka.admin.AdminUtils;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ DMaaPAuthenticatorImpl.class, AJSCPropertiesMap.class })\r
-public class EventsServiceImplTest {\r
-\r
- private InputStream iStream = null;\r
- DMaaPContext dMaapContext = new DMaaPContext();\r
- EventsServiceImpl service = new EventsServiceImpl();\r
- DMaaPErrorMessages pErrorMessages = new DMaaPErrorMessages();\r
- @Mock\r
- ConfigurationReader configurationReader;\r
- @Mock\r
- Blacklist blacklist;\r
- @Mock\r
- DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;\r
- @Mock\r
- DMaaPAAFAuthenticator dmaapAAFauthenticator;\r
- @Mock\r
- NsaApiKey user;\r
- @Mock\r
- NsaSimpleApiKey nsaSimpleApiKey;\r
- @Mock\r
- DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;\r
- @Mock\r
- Topic createdTopic;\r
- @Mock\r
- ConsumerFactory factory;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- String source = "source of my InputStream";\r
- iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));\r
-\r
- MockHttpServletRequest request = new MockHttpServletRequest();\r
- MockHttpServletResponse response = new MockHttpServletResponse();\r
- dMaapContext.setRequest(request);\r
- dMaapContext.setResponse(response);\r
- when(blacklist.contains(anyString())).thenReturn(false);\r
- when(configurationReader.getfIpBlackList()).thenReturn(blacklist);\r
- dMaapContext.setConfigReader(configurationReader);\r
-\r
- service.setErrorMessages(pErrorMessages);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout")).thenReturn("100");\r
-\r
- AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout");\r
-\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testGetEvents() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException {\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testGetEventsBlackListErr() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException {\r
- when(blacklist.contains(anyString())).thenReturn(true);\r
- when(configurationReader.getfIpBlackList()).thenReturn(blacklist);\r
- dMaapContext.setConfigReader(configurationReader);\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testGetEventsNoTopicError() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException {\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(null);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testGetEventsuserNull() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException {\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(null);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- MockHttpServletRequest mockRequest = new MockHttpServletRequest();\r
- mockRequest.addHeader("Authorization", "passed");\r
- dMaapContext.setRequest(mockRequest);\r
- dMaapContext.getRequest().getHeader("Authorization");\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testGetEventsExcp2() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException {\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- when(configurationReader.getfRateLimiter()).thenThrow(new ConcurrentModificationException("Error occurred"));\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testPushEvents() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,\r
- invalidSettingValue, loadException {\r
-\r
- // AdminUtils.createTopic(configurationReader.getZk(), "testTopic", 10,\r
- // 1, new Properties());\r
-\r
- configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));\r
-\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
-\r
- service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- service.getEvents(dMaapContext, "testTopic", "CG1", "23");\r
-\r
- /*\r
- * String trueValue = "True";\r
- * assertTrue(trueValue.equalsIgnoreCase("True"));\r
- */\r
-\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testPushEventsBlackListedIp() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,\r
- invalidSettingValue, loadException {\r
-\r
- // AdminUtils.createTopic(configurationReader.getZk(), "testTopic", 10,\r
- // 1, new Properties());\r
- when(blacklist.contains(anyString())).thenReturn(true);\r
- when(configurationReader.getfIpBlackList()).thenReturn(blacklist);\r
- configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
-\r
- service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void testPushEventsNoUser() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,\r
- invalidSettingValue, loadException {\r
-\r
- configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));\r
-\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(null);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- MockHttpServletRequest mockRequest = new MockHttpServletRequest();\r
- mockRequest.addHeader("Authorization", "passed");\r
- mockRequest.addHeader("Authorization", "passed");\r
- dMaapContext.setRequest(mockRequest);\r
- dMaapContext.getRequest().getHeader("Authorization");\r
- service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- }\r
-\r
- @Test(expected = CambriaApiException.class)\r
- public void testPushEventsWtTransaction() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,\r
- invalidSettingValue, loadException {\r
-\r
- configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));\r
-\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "transidUEBtopicreqd")).thenReturn("true");\r
-\r
- service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- }\r
- \r
- @Test(expected = CambriaApiException.class)\r
- public void testPushEventsWtTransactionError() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,\r
- TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,\r
- invalidSettingValue, loadException {\r
-\r
- configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));\r
-\r
- when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);\r
- PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "transidUEBtopicreqd")).thenReturn("true");\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "event.batch.length")).thenReturn("0");\r
- when(configurationReader.getfPublisher()).thenThrow(new ConcurrentModificationException("Error occurred"));\r
-\r
- service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- }\r
- \r
- @Test\r
- public void testIsTransEnabled1() {\r
-\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,\r
- "transidUEBtopicreqd")).thenReturn("true");\r
- assertTrue(service.isTransEnabled());\r
-\r
- }\r
- @Test\r
- public void testIsTransEnabled2() {\r
-\r
- when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,\r
- "transidUEBtopicreqd")).thenReturn("false");\r
- assertFalse(service.isTransEnabled());\r
-\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.mockito.Mockito.when;
+import static org.mockito.Matchers.anyString;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ConcurrentModificationException;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import com.att.ajsc.beans.PropertiesMapBean;
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPCambriaLimiter;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.service.impl.EventsServiceImpl;
+import org.onap.dmaap.dmf.mr.utils.PropertyReader;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.invalidSettingValue;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+import com.att.nsa.limits.Blacklist;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.NsaApiKey;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import kafka.admin.AdminUtils;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, AJSCPropertiesMap.class })
+public class EventsServiceImplTest {
+
+ private InputStream iStream = null;
+ DMaaPContext dMaapContext = new DMaaPContext();
+ EventsServiceImpl service = new EventsServiceImpl();
+ DMaaPErrorMessages pErrorMessages = new DMaaPErrorMessages();
+ @Mock
+ ConfigurationReader configurationReader;
+ @Mock
+ Blacklist blacklist;
+ @Mock
+ DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
+ @Mock
+ DMaaPAAFAuthenticator dmaapAAFauthenticator;
+ @Mock
+ NsaApiKey user;
+ @Mock
+ NsaSimpleApiKey nsaSimpleApiKey;
+ @Mock
+ DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+ @Mock
+ Topic createdTopic;
+ @Mock
+ ConsumerFactory factory;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ String source = "source of my InputStream";
+ iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ dMaapContext.setRequest(request);
+ dMaapContext.setResponse(response);
+ when(blacklist.contains(anyString())).thenReturn(false);
+ when(configurationReader.getfIpBlackList()).thenReturn(blacklist);
+ dMaapContext.setConfigReader(configurationReader);
+
+ service.setErrorMessages(pErrorMessages);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout")).thenReturn("100");
+
+ AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testGetEvents() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException {
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testGetEventsBlackListErr() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException {
+ when(blacklist.contains(anyString())).thenReturn(true);
+ when(configurationReader.getfIpBlackList()).thenReturn(blacklist);
+ dMaapContext.setConfigReader(configurationReader);
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testGetEventsNoTopicError() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException {
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(null);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testGetEventsuserNull() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException {
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(null);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ MockHttpServletRequest mockRequest = new MockHttpServletRequest();
+ mockRequest.addHeader("Authorization", "passed");
+ dMaapContext.setRequest(mockRequest);
+ dMaapContext.getRequest().getHeader("Authorization");
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testGetEventsExcp2() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException {
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ when(configurationReader.getfRateLimiter()).thenThrow(new ConcurrentModificationException("Error occurred"));
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,
+ invalidSettingValue, loadException {
+
+ // AdminUtils.createTopic(configurationReader.getZk(), "testTopic", 10,
+ // 1, new Properties());
+
+ configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));
+
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+
+ service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ service.getEvents(dMaapContext, "testTopic", "CG1", "23");
+
+ /*
+ * String trueValue = "True";
+ * assertTrue(trueValue.equalsIgnoreCase("True"));
+ */
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEventsBlackListedIp() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,
+ invalidSettingValue, loadException {
+
+ // AdminUtils.createTopic(configurationReader.getZk(), "testTopic", 10,
+ // 1, new Properties());
+ when(blacklist.contains(anyString())).thenReturn(true);
+ when(configurationReader.getfIpBlackList()).thenReturn(blacklist);
+ configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+
+ service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testPushEventsNoUser() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,
+ invalidSettingValue, loadException {
+
+ configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));
+
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(null);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ MockHttpServletRequest mockRequest = new MockHttpServletRequest();
+ mockRequest.addHeader("Authorization", "passed");
+ mockRequest.addHeader("Authorization", "passed");
+ dMaapContext.setRequest(mockRequest);
+ dMaapContext.getRequest().getHeader("Authorization");
+ service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEventsWtTransaction() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,
+ invalidSettingValue, loadException {
+
+ configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));
+
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "transidUEBtopicreqd")).thenReturn("true");
+
+ service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEventsWtTransactionError() throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,
+ TopicExistsException, AccessDeniedException, UnavailableException, IOException, missingReqdSetting,
+ invalidSettingValue, loadException {
+
+ configurationReader.setfRateLimiter(new DMaaPCambriaLimiter(new PropertyReader()));
+
+ when(dmaaPAuthenticator.authenticate(dMaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configurationReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(configurationReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(createdTopic);
+ PowerMockito.when(configurationReader.getfConsumerFactory()).thenReturn(factory);
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "transidUEBtopicreqd")).thenReturn("true");
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "event.batch.length")).thenReturn("0");
+ when(configurationReader.getfPublisher()).thenThrow(new ConcurrentModificationException("Error occurred"));
+
+ service.pushEvents(dMaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ }
+
+ @Test
+ public void testIsTransEnabled1() {
+
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,
+ "transidUEBtopicreqd")).thenReturn("true");
+ assertTrue(service.isTransEnabled());
+
+ }
+ @Test
+ public void testIsTransEnabled2() {
+
+ when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,
+ "transidUEBtopicreqd")).thenReturn("false");
+ assertFalse(service.isTransEnabled());
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import junit.framework.TestSuite;\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ UIServiceImplTest.class, AdminServiceImplemTest.class, ApiKeysServiceImplTest.class, \r
- ShowConsumerCacheTest.class,TopicServiceImplTest.class, TransactionServiceImplTest.class, MMServiceImplTest.class, \r
- BaseTransactionDbImplTest.class, MetricsServiceImplTest.class,EventsServiceImplTest.class})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ UIServiceImplTest.class, AdminServiceImplemTest.class, ApiKeysServiceImplTest.class,
+ ShowConsumerCacheTest.class,TopicServiceImplTest.class, TransactionServiceImplTest.class, MMServiceImplTest.class,
+ BaseTransactionDbImplTest.class, MetricsServiceImplTest.class,EventsServiceImplTest.class})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.Arrays;\r
-import java.util.ConcurrentModificationException;\r
-import java.util.HashSet;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.backends.ConsumerFactory;\r
-import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.service.impl.MMServiceImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.dmf.mr.utils.Emailer;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;\r
-import com.att.nsa.limits.Blacklist;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-import com.att.nsa.security.db.NsaApiDb;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import static org.mockito.Matchers.anyString;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-import org.springframework.mock.web.MockHttpServletResponse;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class, PropertiesMapBean.class,\r
- AJSCPropertiesMap.class })\r
-public class MMServiceImplTest {\r
-\r
- @InjectMocks\r
- MMServiceImpl service;\r
-\r
- @Mock\r
- DMaaPContext dmaapContext;\r
- @Mock\r
- ConsumerFactory factory;\r
- @Mock\r
- private DMaaPErrorMessages errorMessages;\r
- @Mock\r
- ConfigurationReader configReader;\r
- @Mock\r
- Blacklist Blacklist;\r
- @Mock\r
- Emailer emailer;\r
- @Mock\r
- DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;\r
- @Mock\r
- Topic metatopic;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);\r
- NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");\r
-\r
- PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);\r
- PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);\r
-\r
- PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);\r
- PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
-\r
- MockHttpServletRequest request = new MockHttpServletRequest();\r
- MockHttpServletResponse response = new MockHttpServletResponse();\r
- PowerMockito.when(dmaapContext.getRequest()).thenReturn(request);\r
- PowerMockito.when(dmaapContext.getResponse()).thenReturn(response);\r
-\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout")).thenReturn("1000");\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "pretty")).thenReturn("true");\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "meta")).thenReturn("true");\r
- PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testSubscribe_Blacklistip() {\r
-\r
- try {\r
- PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);\r
- service.subscribe(dmaapContext, "testTopic", "CG1", "23");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- } catch (CambriaApiException e) {\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (UnavailableException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testSubscribe_NullTopic() {\r
-\r
- try {\r
- PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);\r
- service.subscribe(dmaapContext, "testTopic", "CG1", "23");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (CambriaApiException e) {\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (UnavailableException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
- \r
- @Test(expected = CambriaApiException.class)\r
- public void testSubscribe_NullTopic_Error() throws ConfigDbException, TopicExistsException, AccessDeniedException, UnavailableException,\r
- CambriaApiException, IOException {\r
-\r
- PowerMockito.when(configReader.getfMetrics()).thenThrow(new ConcurrentModificationException("Error occurred"));\r
- PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(metatopic);\r
- service.subscribe(dmaapContext, "testTopic", "CG1", "23");\r
- }\r
-\r
- @Test\r
- public void testPushEvents_wttransaction() {\r
-\r
- String source = "source of my InputStream";\r
-\r
- try {\r
- InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));\r
- service.pushEvents(dmaapContext, "msgrtr.apinode.metrics.dmaap", iStream, "3", "12:00:00");\r
-\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (CambriaApiException e) {\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- }\r
- \r
- @Test(expected = CambriaApiException.class)\r
- public void testPushEvents_wttransaction_error() throws Exception {\r
-\r
- String source = "source of my InputStream";\r
-\r
- InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "event.batch.length")).thenReturn("-5");\r
- PowerMockito.when(configReader.getfPublisher()).thenThrow(new ConcurrentModificationException("Error occurred"));\r
- service.pushEvents(dmaapContext, "msgrtr.apinode.metrics.dmaap1", iStream, "3", "12:00:00");\r
-\r
- }\r
-\r
- @Test\r
- public void testPushEvents() {\r
-\r
- String source = "source of my InputStream";\r
-\r
- try {\r
- InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));\r
- service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (CambriaApiException e) {\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testPushEvents_blacklistip() {\r
-\r
- String source = "source of my InputStream";\r
-\r
- try {\r
- PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);\r
- InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));\r
- service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");\r
-\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (CambriaApiException e) {\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (TopicExistsException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (AccessDeniedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (missingReqdSetting e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
- NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {\r
-\r
- Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));\r
-\r
- @Override\r
- public NsaSimpleApiKey createApiKey(String arg0, String arg1)\r
- throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return new NsaSimpleApiKey(arg0, arg1);\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(String arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Set<String> loadAllKeys() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
-\r
- return keys;\r
- }\r
-\r
- @Override\r
- public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {\r
- if (!keys.contains(arg0)) {\r
- return null;\r
- }\r
- return new NsaSimpleApiKey(arg0, "password");\r
- }\r
-\r
- @Override\r
- public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
- };\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.att.ajsc.beans.PropertiesMapBean;
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.impl.MMServiceImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import org.onap.dmaap.dmf.mr.utils.Emailer;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+import com.att.nsa.limits.Blacklist;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.NsaApiDb;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.mockito.Matchers.anyString;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class, PropertiesMapBean.class,
+ AJSCPropertiesMap.class })
+public class MMServiceImplTest {
+
+ @InjectMocks
+ MMServiceImpl service;
+
+ @Mock
+ DMaaPContext dmaapContext;
+ @Mock
+ ConsumerFactory factory;
+ @Mock
+ private DMaaPErrorMessages errorMessages;
+ @Mock
+ ConfigurationReader configReader;
+ @Mock
+ Blacklist Blacklist;
+ @Mock
+ Emailer emailer;
+ @Mock
+ DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+ @Mock
+ Topic metatopic;
+
+ @Before
+ public void setUp() throws Exception {
+
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+ NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+ PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+ PowerMockito.when(configReader.getfIpBlackList()).thenReturn(Blacklist);
+
+ PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+ PowerMockito.when(configReader.getSystemEmailer()).thenReturn(emailer);
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ PowerMockito.when(dmaapContext.getRequest()).thenReturn(request);
+ PowerMockito.when(dmaapContext.getResponse()).thenReturn(response);
+
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "timeout")).thenReturn("1000");
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "pretty")).thenReturn("true");
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "meta")).thenReturn("true");
+ PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testSubscribe_Blacklistip() {
+
+ try {
+ PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);
+ service.subscribe(dmaapContext, "testTopic", "CG1", "23");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ } catch (CambriaApiException e) {
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (UnavailableException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testSubscribe_NullTopic() {
+
+ try {
+ PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
+ service.subscribe(dmaapContext, "testTopic", "CG1", "23");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (CambriaApiException e) {
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (UnavailableException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testSubscribe_NullTopic_Error() throws ConfigDbException, TopicExistsException, AccessDeniedException, UnavailableException,
+ CambriaApiException, IOException {
+
+ PowerMockito.when(configReader.getfMetrics()).thenThrow(new ConcurrentModificationException("Error occurred"));
+ PowerMockito.when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(metatopic);
+ service.subscribe(dmaapContext, "testTopic", "CG1", "23");
+ }
+
+ @Test
+ public void testPushEvents_wttransaction() {
+
+ String source = "source of my InputStream";
+
+ try {
+ InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+ service.pushEvents(dmaapContext, "msgrtr.apinode.metrics.dmaap", iStream, "3", "12:00:00");
+
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (CambriaApiException e) {
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test(expected = CambriaApiException.class)
+ public void testPushEvents_wttransaction_error() throws Exception {
+
+ String source = "source of my InputStream";
+
+ InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "event.batch.length")).thenReturn("-5");
+ PowerMockito.when(configReader.getfPublisher()).thenThrow(new ConcurrentModificationException("Error occurred"));
+ service.pushEvents(dmaapContext, "msgrtr.apinode.metrics.dmaap1", iStream, "3", "12:00:00");
+
+ }
+
+ @Test
+ public void testPushEvents() {
+
+ String source = "source of my InputStream";
+
+ try {
+ InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+ service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (CambriaApiException e) {
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testPushEvents_blacklistip() {
+
+ String source = "source of my InputStream";
+
+ try {
+ PowerMockito.when(Blacklist.contains("127.0.0.1")).thenReturn(true);
+ InputStream iStream = new ByteArrayInputStream(source.getBytes("UTF-8"));
+ service.pushEvents(dmaapContext, "testTopic", iStream, "3", "12:00:00");
+
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (CambriaApiException e) {
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (TopicExistsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (AccessDeniedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (missingReqdSetting e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {
+
+ Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));
+
+ @Override
+ public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+ throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+ // TODO Auto-generated method stub
+ return new NsaSimpleApiKey(arg0, arg1);
+ }
+
+ @Override
+ public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean deleteApiKey(String arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set<String> loadAllKeys() throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ return keys;
+ }
+
+ @Override
+ public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+ if (!keys.contains(arg0)) {
+ return null;
+ }
+ return new NsaSimpleApiKey(arg0, "password");
+ }
+
+ @Override
+ public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ }
+ };
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import com.att.dmf.mr.backends.Publisher.message;\r
-import com.att.dmf.mr.beans.LogDetails;\r
-\r
-public class MessageTest implements message {\r
-\r
- @Override\r
- public String getKey() {\r
- // TODO Auto-generated method stub\r
- return "123";\r
- }\r
-\r
- @Override\r
- public String getMessage() {\r
- // TODO Auto-generated method stub\r
- return "Msg";\r
- }\r
-\r
- @Override\r
- public void setLogDetails(LogDetails logDetails) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- @Override\r
- public LogDetails getLogDetails() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public boolean isTransactionEnabled() {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public void setTransactionEnabled(boolean transactionEnabled) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import org.onap.dmaap.dmf.mr.backends.Publisher.message;
+import org.onap.dmaap.dmf.mr.beans.LogDetails;
+
+public class MessageTest implements message {
+
+ @Override
+ public String getKey() {
+ // TODO Auto-generated method stub
+ return "123";
+ }
+
+ @Override
+ public String getMessage() {
+ // TODO Auto-generated method stub
+ return "Msg";
+ }
+
+ @Override
+ public void setLogDetails(LogDetails logDetails) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public LogDetails getLogDetails() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isTransactionEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setTransactionEnabled(boolean transactionEnabled) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.service.impl.MetricsServiceImpl;\r
-\r
-public class MetricsServiceImplTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- @Test\r
- public void testGet() {\r
- \r
- MetricsServiceImpl service = new MetricsServiceImpl();\r
- try {\r
- service.get(new DMaaPContext());\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
- @Test\r
- public void testGetMetricByName() {\r
- \r
- MetricsServiceImpl service = new MetricsServiceImpl();\r
- try {\r
- service.getMetricByName(new DMaaPContext(), "uptime");\r
- } catch (org.json.JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- //e.printStackTrace();\r
- assertTrue(true);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (CambriaApiException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.service.impl.MetricsServiceImpl;
+
+public class MetricsServiceImplTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGet() {
+
+ MetricsServiceImpl service = new MetricsServiceImpl();
+ try {
+ service.get(new DMaaPContext());
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+ @Test
+ public void testGetMetricByName() {
+
+ MetricsServiceImpl service = new MetricsServiceImpl();
+ try {
+ service.getMetricByName(new DMaaPContext(), "uptime");
+ } catch (org.json.JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ assertTrue(true);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (CambriaApiException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-import static org.junit.Assert.assertEquals;\r
-import static org.mockito.Matchers.anyBoolean;\r
-import static org.mockito.Matchers.anyInt;\r
-import static org.mockito.Matchers.anyString;\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-\r
-import java.io.IOException;\r
-import java.util.Arrays;\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-import org.mockito.runners.MockitoJUnitRunner;\r
-\r
-import com.att.aft.dme2.internal.jettison.json.JSONArray;\r
-import com.att.aft.dme2.internal.jettison.json.JSONException;\r
-import com.att.aft.dme2.internal.jettison.json.JSONObject;\r
-\r
-import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.TopicBean;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.exception.DMaaPAccessDeniedException;\r
-import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.nsa.security.NsaApiKey;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import jline.internal.Log;\r
-import kafka.consumer.Consumer;\r
-\r
-\r
-\r
-//@RunWith(MockitoJUnitRunner.class)\r
-//@RunWith(PowerMockRunner.class)\r
-//@PrepareForTest(PropertiesMapBean.class)\r
-public class ShowConsumerCacheTest {\r
-/*\r
-@InjectMocks\r
-TopicServiceImpl topicService;\r
-\r
-@Mock\r
-private DMaaPErrorMessages errorMessages;\r
-\r
-@Mock\r
-DMaaPContext dmaapContext;\r
-\r
-@Mock\r
-ConfigurationReader configReader;\r
-\r
-\r
-@Mock\r
-JSONObject consumers;\r
-\r
-@Mock\r
-JSONObject consumerObject;\r
-\r
-@Mock\r
-JSONArray jsonConsumersList;\r
-\r
-@Mock\r
-DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;\r
-\r
-@Mock\r
-NsaApiKey user;\r
-\r
-@Mock\r
-NsaSimpleApiKey nsaSimpleApiKey;\r
-\r
-@Mock\r
-HttpServletRequest httpServReq;\r
-\r
-\r
-@Before\r
-public void setUp(){\r
-MockitoAnnotations.initMocks(this);\r
-}\r
-\r
-\r
-//@Test(expected = DMaaPAccessDeniedException.class)\r
-@Test\r
-public void testShowConsmerCache()throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException, JSONException{\r
-Assert.assertNotNull(topicService);\r
-\r
-String myName = "Brian";\r
-Object created = null;\r
-Object accessed = null;\r
-Object log = null;\r
-Object info = null;\r
-\r
-when(consumerObject.put("name", myName)).thenReturn(consumerObject);\r
-when(consumerObject.put("created", created)).thenReturn(consumerObject);\r
-when(consumerObject.put("accessed", accessed)).thenReturn(consumerObject);\r
-when(consumerObject.put("accessed", Consumer.class)).thenReturn(consumerObject);\r
-when(jsonConsumersList.put(consumerObject)).thenReturn(null);\r
-\r
-when(consumers.put("consumers", jsonConsumersList)).thenReturn(consumerObject);\r
-\r
-\r
-\r
-}*/\r
-\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.att.aft.dme2.internal.jettison.json.JSONArray;
+import com.att.aft.dme2.internal.jettison.json.JSONException;
+import com.att.aft.dme2.internal.jettison.json.JSONObject;
+
+import com.att.ajsc.beans.PropertiesMapBean;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import com.att.nsa.security.NsaApiKey;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import jline.internal.Log;
+import kafka.consumer.Consumer;
+
+
+
+//@RunWith(MockitoJUnitRunner.class)
+//@RunWith(PowerMockRunner.class)
+//@PrepareForTest(PropertiesMapBean.class)
+public class ShowConsumerCacheTest {
+/*
+@InjectMocks
+TopicServiceImpl topicService;
+
+@Mock
+private DMaaPErrorMessages errorMessages;
+
+@Mock
+DMaaPContext dmaapContext;
+
+@Mock
+ConfigurationReader configReader;
+
+
+@Mock
+JSONObject consumers;
+
+@Mock
+JSONObject consumerObject;
+
+@Mock
+JSONArray jsonConsumersList;
+
+@Mock
+DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
+
+@Mock
+NsaApiKey user;
+
+@Mock
+NsaSimpleApiKey nsaSimpleApiKey;
+
+@Mock
+HttpServletRequest httpServReq;
+
+
+@Before
+public void setUp(){
+MockitoAnnotations.initMocks(this);
+}
+
+
+//@Test(expected = DMaaPAccessDeniedException.class)
+@Test
+public void testShowConsmerCache()throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException, JSONException{
+Assert.assertNotNull(topicService);
+
+String myName = "Brian";
+Object created = null;
+Object accessed = null;
+Object log = null;
+Object info = null;
+
+when(consumerObject.put("name", myName)).thenReturn(consumerObject);
+when(consumerObject.put("created", created)).thenReturn(consumerObject);
+when(consumerObject.put("accessed", accessed)).thenReturn(consumerObject);
+when(consumerObject.put("accessed", Consumer.class)).thenReturn(consumerObject);
+when(jsonConsumersList.put(consumerObject)).thenReturn(null);
+
+when(consumers.put("consumers", jsonConsumersList)).thenReturn(consumerObject);
+
+
+
+}*/
+
+
}
\ No newline at end of file
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.mockito.Matchers.anyBoolean;\r
-import static org.mockito.Matchers.anyInt;\r
-import static org.mockito.Matchers.anyString;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-\r
-import java.io.IOException;\r
-import java.util.Arrays;\r
-import java.util.HashSet;\r
-\r
-import javax.servlet.ServletOutputStream;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.json.JSONArray;\r
-import org.json.JSONException;\r
-import org.json.JSONObject;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-\r
-import com.att.ajsc.beans.PropertiesMapBean;\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.CambriaApiException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.beans.TopicBean;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.exception.DMaaPAccessDeniedException;\r
-import com.att.dmf.mr.exception.DMaaPErrorMessages;\r
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.dmf.mr.security.DMaaPAAFAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticator;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.service.impl.TopicServiceImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.NsaAcl;\r
-import com.att.nsa.security.NsaApiKey;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-//@RunWith(MockitoJUnitRunner.class)\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ PropertiesMapBean.class, DMaaPAuthenticatorImpl.class,AJSCPropertiesMap.class,DMaaPResponseBuilder.class })\r
-public class TopicServiceImplTest {\r
-\r
- TopicServiceImpl topicService;\r
-\r
- @Mock\r
- private DMaaPErrorMessages errorMessages;\r
-\r
- @Mock\r
- DMaaPContext dmaapContext;\r
-\r
- @Mock\r
- ConfigurationReader configReader;\r
-\r
- @Mock\r
- ServletOutputStream oStream;\r
-\r
- @Mock\r
- DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;\r
-\r
- @Mock\r
- DMaaPAAFAuthenticator dmaapAAFauthenticator;\r
- @Mock\r
- NsaApiKey user;\r
-\r
- @Mock\r
- NsaSimpleApiKey nsaSimpleApiKey;\r
-\r
- @Mock\r
- HttpServletRequest httpServReq;\r
-\r
- @Mock\r
- HttpServletResponse httpServRes;\r
-\r
- @Mock\r
- DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;\r
-\r
- @Mock\r
- Topic createdTopic;\r
-\r
- @Mock\r
- NsaAcl nsaAcl;\r
-\r
- @Mock\r
- JSONObject jsonObj;\r
-\r
- @Mock\r
- JSONArray jsonArray;\r
-\r
- @Before\r
- public void setUp() {\r
- MockitoAnnotations.initMocks(this);\r
- topicService = new TopicServiceImpl();\r
- topicService.setErrorMessages(errorMessages);\r
- NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");\r
- PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void testCreateTopicWithEnforcedName()\r
- throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
- \r
- Assert.assertNotNull(topicService);\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
-\r
- when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))\r
- .thenReturn("enfTopicName");\r
-\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
-\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
- topicService.createTopic(dmaapContext, topicBean);\r
- }\r
-\r
- @Test\r
- public void testCreateTopicWithTopicNameNotEnforced()\r
- throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,IOException,TopicExistsException, com.att.dmf.mr.metabroker.Broker1.TopicExistsException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
-\r
- when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))\r
- .thenReturn("enfTopicName");\r
-\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
-\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
-\r
- when(nsaAcl.isActive()).thenReturn(true);\r
- when(nsaAcl.getUsers()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));\r
-\r
- when(createdTopic.getName()).thenReturn("topicName");\r
- when(createdTopic.getOwner()).thenReturn("Owner");\r
- when(createdTopic.getDescription()).thenReturn("Description");\r
- when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);\r
- when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);\r
-\r
- when(dmaapKafkaMetaBroker.createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(), anyBoolean()))\r
- .thenReturn(createdTopic);\r
-\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("NotEnforcedTopicName");\r
-\r
- topicService.createTopic(dmaapContext, topicBean);\r
-\r
- verify(dmaapKafkaMetaBroker, times(1)).createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(),\r
- anyBoolean());\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void testCreateTopicNoUserInContextAndNoAuthHeader()\r
- throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
- \r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
-\r
- when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))\r
- .thenReturn("enfTopicName");\r
-\r
- when(httpServReq.getHeader("Authorization")).thenReturn(null);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
-\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
- topicService.createTopic(dmaapContext, topicBean);\r
- }\r
-\r
- @Test(expected = NullPointerException.class)\r
- public void testCreateTopicNoUserInContextAndAuthHeaderAndPermitted()\r
- throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {\r
- \r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(PropertiesMapBean.class);\r
-\r
- when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))\r
- .thenReturn("enfTopicName");\r
-\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Authorization");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
-\r
- // when(dmaapAAFauthenticator.aafAuthentication(httpServReq,\r
- // anyString())).thenReturn(false);\r
-\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
- topicService.createTopic(dmaapContext, topicBean);\r
- }\r
-\r
- @Test(expected = TopicExistsException.class)\r
- public void testGetTopics_null_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException {\r
-\r
- Assert.assertNotNull(topicService);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);\r
-\r
- topicService.getTopic(dmaapContext, "topicName");\r
- }\r
-\r
- @Test\r
- public void testGetTopics_NonNull_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException {\r
-\r
- Assert.assertNotNull(topicService);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
-\r
- when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(createdTopic);\r
-\r
- when(createdTopic.getName()).thenReturn("topicName");\r
- when(createdTopic.getDescription()).thenReturn("topicDescription");\r
- when(createdTopic.getOwners()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));\r
-\r
- when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);\r
- when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);\r
-\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(httpServRes.getOutputStream()).thenReturn(oStream);\r
-\r
- topicService.getTopic(dmaapContext, "topicName");\r
- }\r
-\r
- @Test(expected = TopicExistsException.class)\r
- public void testGetPublishersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,\r
- IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);\r
-\r
- topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");\r
-\r
- }\r
-\r
- @Test\r
- public void testGetPublishersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,\r
- IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);\r
- when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);\r
- topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");\r
- }\r
-\r
- @Test(expected = TopicExistsException.class)\r
- public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,\r
- IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);\r
-\r
- topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");\r
-\r
- }\r
-\r
- @Test\r
- public void testGetConsumersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,\r
- IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);\r
-\r
- when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);\r
-\r
- topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");\r
- }\r
-\r
- @Test\r
- public void testGetPublishersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
-\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
-\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("topicFactoryAAF");\r
-\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);\r
-\r
- when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);\r
-\r
- topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testGetPublishersByTopicNameError() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
-\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
-\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("topicFactoryAAF");\r
-\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(httpServReq.getMethod()).thenReturn("HEAD");\r
-\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);\r
-\r
- when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);\r
-\r
- topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");\r
- }\r
-\r
- @Test\r
- public void testdeleteTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.deleteTopic(dmaapContext, "topicNamespace.topic");\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testdeleteTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.deleteTopic(dmaapContext, "topicNamespace.topic");\r
- }\r
- \r
- /*@Test(expected=DMaaPAccessDeniedException.class)\r
- public void testdeleteTopic_authHeader() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(null);\r
- topicService.deleteTopic(dmaapContext, "topicNamespace.topic");\r
- }*/\r
- \r
- @Test\r
- public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testPermitConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- @Test\r
- public void testdenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testdenyConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- \r
- @Test\r
- public void testPermitPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testPermitPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");\r
- }\r
- \r
- @Test\r
- public void testDenyPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
- when(dmaapContext.getResponse()).thenReturn(httpServRes);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;\r
- }\r
- \r
- @Test(expected=TopicExistsException.class)\r
- public void testDenyPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
-\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;\r
- }\r
- \r
- @Test\r
- public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.getAllTopics(dmaapContext);\r
- }\r
- \r
- @Test\r
- public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,\r
- TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {\r
-\r
- Assert.assertNotNull(topicService);\r
-\r
- // PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.mockStatic(AJSCPropertiesMap.class);\r
- PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))\r
- .thenReturn("hello");\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);\r
- when(httpServReq.getHeader("AppName")).thenReturn("MyApp");\r
- when(httpServReq.getHeader("Authorization")).thenReturn("Admin");\r
- when(dmaapContext.getRequest()).thenReturn(httpServReq);\r
-\r
- when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);\r
- when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);\r
- TopicBean topicBean = new TopicBean();\r
- topicBean.setTopicName("enfTopicNamePlusExtra");\r
-\r
- topicService.getTopics(dmaapContext);\r
- }\r
- \r
-\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.att.ajsc.beans.PropertiesMapBean;
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.CambriaApiException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.beans.TopicBean;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.exception.DMaaPAccessDeniedException;
+import org.onap.dmaap.dmf.mr.exception.DMaaPErrorMessages;
+import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticator;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.service.impl.TopicServiceImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.NsaAcl;
+import com.att.nsa.security.NsaApiKey;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+//@RunWith(MockitoJUnitRunner.class)
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PropertiesMapBean.class, DMaaPAuthenticatorImpl.class,AJSCPropertiesMap.class,DMaaPResponseBuilder.class })
+public class TopicServiceImplTest {
+
+ TopicServiceImpl topicService;
+
+ @Mock
+ private DMaaPErrorMessages errorMessages;
+
+ @Mock
+ DMaaPContext dmaapContext;
+
+ @Mock
+ ConfigurationReader configReader;
+
+ @Mock
+ ServletOutputStream oStream;
+
+ @Mock
+ DMaaPAuthenticator<NsaSimpleApiKey> dmaaPAuthenticator;
+
+ @Mock
+ DMaaPAAFAuthenticator dmaapAAFauthenticator;
+ @Mock
+ NsaApiKey user;
+
+ @Mock
+ NsaSimpleApiKey nsaSimpleApiKey;
+
+ @Mock
+ HttpServletRequest httpServReq;
+
+ @Mock
+ HttpServletResponse httpServRes;
+
+ @Mock
+ DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+
+ @Mock
+ Topic createdTopic;
+
+ @Mock
+ NsaAcl nsaAcl;
+
+ @Mock
+ JSONObject jsonObj;
+
+ @Mock
+ JSONArray jsonArray;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ topicService = new TopicServiceImpl();
+ topicService.setErrorMessages(errorMessages);
+ NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+ PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateTopicWithEnforcedName()
+ throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
+
+ Assert.assertNotNull(topicService);
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+
+ when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
+ .thenReturn("enfTopicName");
+
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+ topicService.createTopic(dmaapContext, topicBean);
+ }
+
+ @Test
+ public void testCreateTopicWithTopicNameNotEnforced()
+ throws DMaaPAccessDeniedException, CambriaApiException, ConfigDbException,IOException,TopicExistsException, org.onap.dmaap.dmf.mr.metabroker.Broker1.TopicExistsException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+ when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
+ .thenReturn("enfTopicName");
+
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(nsaSimpleApiKey);
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+
+ when(nsaAcl.isActive()).thenReturn(true);
+ when(nsaAcl.getUsers()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));
+
+ when(createdTopic.getName()).thenReturn("topicName");
+ when(createdTopic.getOwner()).thenReturn("Owner");
+ when(createdTopic.getDescription()).thenReturn("Description");
+ when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+ when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
+
+ when(dmaapKafkaMetaBroker.createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(), anyBoolean()))
+ .thenReturn(createdTopic);
+
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("NotEnforcedTopicName");
+
+ topicService.createTopic(dmaapContext, topicBean);
+
+ verify(dmaapKafkaMetaBroker, times(1)).createTopic(anyString(), anyString(), anyString(), anyInt(), anyInt(),
+ anyBoolean());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateTopicNoUserInContextAndNoAuthHeader()
+ throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+
+ when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
+ .thenReturn("enfTopicName");
+
+ when(httpServReq.getHeader("Authorization")).thenReturn(null);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+ topicService.createTopic(dmaapContext, topicBean);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateTopicNoUserInContextAndAuthHeaderAndPermitted()
+ throws DMaaPAccessDeniedException, CambriaApiException, IOException, TopicExistsException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(PropertiesMapBean.class);
+
+ when(PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop, "enforced.topic.name.AAF"))
+ .thenReturn("enfTopicName");
+
+ when(httpServReq.getHeader("Authorization")).thenReturn("Authorization");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+
+ // when(dmaapAAFauthenticator.aafAuthentication(httpServReq,
+ // anyString())).thenReturn(false);
+
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+ topicService.createTopic(dmaapContext, topicBean);
+ }
+
+ @Test(expected = TopicExistsException.class)
+ public void testGetTopics_null_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException {
+
+ Assert.assertNotNull(topicService);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(null);
+
+ topicService.getTopic(dmaapContext, "topicName");
+ }
+
+ @Test
+ public void testGetTopics_NonNull_topic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException {
+
+ Assert.assertNotNull(topicService);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+
+ when(dmaapKafkaMetaBroker.getTopic(anyString())).thenReturn(createdTopic);
+
+ when(createdTopic.getName()).thenReturn("topicName");
+ when(createdTopic.getDescription()).thenReturn("topicDescription");
+ when(createdTopic.getOwners()).thenReturn(new HashSet<>(Arrays.asList("user1,user2".split(","))));
+
+ when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+ when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
+
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(httpServRes.getOutputStream()).thenReturn(oStream);
+
+ topicService.getTopic(dmaapContext, "topicName");
+ }
+
+ @Test(expected = TopicExistsException.class)
+ public void testGetPublishersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
+ IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+
+ topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
+
+ }
+
+ @Test
+ public void testGetPublishersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
+ IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
+ when(createdTopic.getWriterAcl()).thenReturn(nsaAcl);
+ topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
+ }
+
+ @Test(expected = TopicExistsException.class)
+ public void testGetConsumersByTopicName_nullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
+ IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+
+ topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
+
+ }
+
+ @Test
+ public void testGetConsumersByTopicName_nonNullTopic() throws DMaaPAccessDeniedException, CambriaApiException,
+ IOException, TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
+
+ when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+
+ topicService.getConsumersByTopicName(dmaapContext, "topicNamespace.name");
+ }
+
+ @Test
+ public void testGetPublishersByTopicName() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("topicFactoryAAF");
+
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(createdTopic);
+
+ when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+
+ topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testGetPublishersByTopicNameError() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("topicFactoryAAF");
+
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(httpServReq.getMethod()).thenReturn("HEAD");
+
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.name")).thenReturn(null);
+
+ when(createdTopic.getReaderAcl()).thenReturn(nsaAcl);
+
+ topicService.getPublishersByTopicName(dmaapContext, "topicNamespace.name");
+ }
+
+ @Test
+ public void testdeleteTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testdeleteTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
+ }
+
+ /*@Test(expected=DMaaPAccessDeniedException.class)
+ public void testdeleteTopic_authHeader() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(null);
+ topicService.deleteTopic(dmaapContext, "topicNamespace.topic");
+ }*/
+
+ @Test
+ public void testPermitConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testPermitConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.permitConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+ @Test
+ public void testdenyConsumerForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testdenyConsumerForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.denyConsumerForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+
+ @Test
+ public void testPermitPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testPermitPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.permitPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");
+ }
+
+ @Test
+ public void testDenyPublisherForTopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+ when(dmaapContext.getResponse()).thenReturn(httpServRes);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;
+ }
+
+ @Test(expected=TopicExistsException.class)
+ public void testDenyPublisherForTopic_nulltopic() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.denyPublisherForTopic(dmaapContext, "topicNamespace.topic", "admin");;
+ }
+
+ @Test
+ public void testGetAllTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.getAllTopics(dmaapContext);
+ }
+
+ @Test
+ public void testGetTopics() throws DMaaPAccessDeniedException, CambriaApiException, IOException,
+ TopicExistsException, JSONException, ConfigDbException, AccessDeniedException {
+
+ Assert.assertNotNull(topicService);
+
+ // PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.mockStatic(AJSCPropertiesMap.class);
+ PowerMockito.when(AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop, "msgRtr.topicfactory.aaf"))
+ .thenReturn("hello");
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ when(dmaaPAuthenticator.authenticate(dmaapContext)).thenReturn(null);
+ when(httpServReq.getHeader("AppName")).thenReturn("MyApp");
+ when(httpServReq.getHeader("Authorization")).thenReturn("Admin");
+ when(dmaapContext.getRequest()).thenReturn(httpServReq);
+
+ when(configReader.getfSecurityManager()).thenReturn(dmaaPAuthenticator);
+ when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(createdTopic);
+ TopicBean topicBean = new TopicBean();
+ topicBean.setTopicName("enfTopicNamePlusExtra");
+
+ topicService.getTopics(dmaapContext);
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import com.att.aft.dme2.internal.jettison.json.JSONException;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.service.impl.TransactionServiceImpl;\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class TransactionServiceImplTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
- \r
- @Test\r
- public void testCheckTransaction() {\r
- \r
- TransactionServiceImpl service = new TransactionServiceImpl();\r
- service.checkTransaction(new TransactionObj("23", 1100, 1000, 10)); \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGetAllTransactionObjs() {\r
- \r
- TransactionServiceImpl service = new TransactionServiceImpl();\r
- try {\r
- service.getAllTransactionObjs(new DMaaPContext());\r
- } catch (ConfigDbException | IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- @Test\r
- public void testGetTransactionObj() {\r
- \r
- TransactionServiceImpl service = new TransactionServiceImpl();\r
- try {\r
- service.getTransactionObj(new DMaaPContext(), "23");\r
- } catch (ConfigDbException | IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (JSONException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import com.att.aft.dme2.internal.jettison.json.JSONException;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.service.impl.TransactionServiceImpl;
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TransactionServiceImplTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testCheckTransaction() {
+
+ TransactionServiceImpl service = new TransactionServiceImpl();
+ service.checkTransaction(new TransactionObj("23", 1100, 1000, 10));
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetAllTransactionObjs() {
+
+ TransactionServiceImpl service = new TransactionServiceImpl();
+ try {
+ service.getAllTransactionObjs(new DMaaPContext());
+ } catch (ConfigDbException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetTransactionObj() {
+
+ TransactionServiceImpl service = new TransactionServiceImpl();
+ try {
+ service.getTransactionObj(new DMaaPContext(), "23");
+ } catch (ConfigDbException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.service.impl;\r
-\r
-import static org.junit.Assert.*;\r
-import static org.mockito.Mockito.when;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import com.att.dmf.mr.backends.ConsumerFactory;\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.beans.DMaaPKafkaMetaBroker;\r
-import com.att.dmf.mr.metabroker.Topic;\r
-import com.att.dmf.mr.service.impl.UIServiceImpl;\r
-import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-import com.att.nsa.configs.ConfigDbException;\r
-import com.att.nsa.security.db.NsaApiDb;\r
-import com.att.nsa.security.db.simple.NsaSimpleApiKey;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.InjectMocks;\r
-import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
-import org.powermock.api.mockito.PowerMockito;\r
-import org.powermock.core.classloader.annotations.PrepareForTest;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })\r
-public class UIServiceImplTest {\r
-\r
- @InjectMocks\r
- UIServiceImpl service;\r
-\r
- @Mock\r
- DMaaPContext dmaapContext;\r
- @Mock\r
- ConsumerFactory factory;\r
-\r
- @Mock\r
- ConfigurationReader configReader;\r
-\r
- @Mock\r
- DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;\r
-\r
- @Mock\r
- Topic metatopic;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);\r
- NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");\r
-\r
- PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);\r
- PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);\r
-\r
- PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);\r
- PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);\r
- PowerMockito.mockStatic(DMaaPResponseBuilder.class);\r
- PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testHello() {\r
-\r
- try {\r
- service.hello(dmaapContext);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
-\r
- }\r
-\r
- @Test\r
- public void testGetApiKeysTable() {\r
-\r
- try {\r
- service.getApiKeysTable(dmaapContext);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetApiKey() {\r
-\r
- try {\r
- service.getApiKey(dmaapContext, "admin");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testGetApiKey_invalidkey() {\r
-\r
- try {\r
- service.getApiKey(dmaapContext, "k56HmWT72J");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- assertTrue(true);\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testGetTopicsTable() {\r
-\r
- try {\r
- List<Topic> topics = new ArrayList<Topic>();\r
- topics.add(metatopic);\r
- when(dmaapKafkaMetaBroker.getAllTopics()).thenReturn(topics);\r
- service.getTopicsTable(dmaapContext);\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
-\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetTopic() {\r
-\r
- try {\r
- when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(metatopic);\r
- service.getTopic(dmaapContext, "testTopic");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
-\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
- }\r
-\r
- @Test\r
- public void testGetTopic_nulltopic() {\r
-\r
- try {\r
- when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);\r
- service.getTopic(dmaapContext, "testTopic");\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- // e.printStackTrace();\r
- } catch (ConfigDbException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {\r
-\r
- Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));\r
-\r
- @Override\r
- public NsaSimpleApiKey createApiKey(String arg0, String arg1)\r
- throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return new NsaSimpleApiKey(arg0, arg1);\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public boolean deleteApiKey(String arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {\r
- Map<String, NsaSimpleApiKey> map = new HashMap<String, NsaSimpleApiKey>();\r
- map.put("testkey", new NsaSimpleApiKey("testkey", "password"));\r
- map.put("admin", new NsaSimpleApiKey("admin", "password"));\r
-\r
- return map;\r
- }\r
-\r
- @Override\r
- public Set<String> loadAllKeys() throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
-\r
- return keys;\r
- }\r
-\r
- @Override\r
- public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {\r
- if (!keys.contains(arg0)) {\r
- return null;\r
- }\r
- return new NsaSimpleApiKey(arg0, "password");\r
- }\r
-\r
- @Override\r
- public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
- };\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.service.impl;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.onap.dmaap.dmf.mr.backends.ConsumerFactory;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.beans.DMaaPKafkaMetaBroker;
+import org.onap.dmaap.dmf.mr.metabroker.Topic;
+import org.onap.dmaap.dmf.mr.service.impl.UIServiceImpl;
+import org.onap.dmaap.dmf.mr.security.DMaaPAuthenticatorImpl;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+import com.att.nsa.configs.ConfigDbException;
+import com.att.nsa.security.db.NsaApiDb;
+import com.att.nsa.security.db.simple.NsaSimpleApiKey;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ DMaaPAuthenticatorImpl.class, DMaaPResponseBuilder.class })
+public class UIServiceImplTest {
+
+ @InjectMocks
+ UIServiceImpl service;
+
+ @Mock
+ DMaaPContext dmaapContext;
+ @Mock
+ ConsumerFactory factory;
+
+ @Mock
+ ConfigurationReader configReader;
+
+ @Mock
+ DMaaPKafkaMetaBroker dmaapKafkaMetaBroker;
+
+ @Mock
+ Topic metatopic;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(DMaaPAuthenticatorImpl.class);
+ NsaSimpleApiKey user = new NsaSimpleApiKey("admin", "password");
+
+ PowerMockito.when(dmaapContext.getConfigReader()).thenReturn(configReader);
+ PowerMockito.when(configReader.getfConsumerFactory()).thenReturn(factory);
+
+ PowerMockito.when(configReader.getfApiKeyDb()).thenReturn(fApiKeyDb);
+ PowerMockito.when(DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext)).thenReturn(user);
+ PowerMockito.mockStatic(DMaaPResponseBuilder.class);
+ PowerMockito.when(configReader.getfMetaBroker()).thenReturn(dmaapKafkaMetaBroker);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testHello() {
+
+ try {
+ service.hello(dmaapContext);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+ @Test
+ public void testGetApiKeysTable() {
+
+ try {
+ service.getApiKeysTable(dmaapContext);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetApiKey() {
+
+ try {
+ service.getApiKey(dmaapContext, "admin");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testGetApiKey_invalidkey() {
+
+ try {
+ service.getApiKey(dmaapContext, "k56HmWT72J");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ assertTrue(true);
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testGetTopicsTable() {
+
+ try {
+ List<Topic> topics = new ArrayList<Topic>();
+ topics.add(metatopic);
+ when(dmaapKafkaMetaBroker.getAllTopics()).thenReturn(topics);
+ service.getTopicsTable(dmaapContext);
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopic() {
+
+ try {
+ when(dmaapKafkaMetaBroker.getTopic("testTopic")).thenReturn(metatopic);
+ service.getTopic(dmaapContext, "testTopic");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+ }
+
+ @Test
+ public void testGetTopic_nulltopic() {
+
+ try {
+ when(dmaapKafkaMetaBroker.getTopic("topicNamespace.topic")).thenReturn(null);
+ service.getTopic(dmaapContext, "testTopic");
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ } catch (ConfigDbException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ }
+
+ NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {
+
+ Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));
+
+ @Override
+ public NsaSimpleApiKey createApiKey(String arg0, String arg1)
+ throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {
+ // TODO Auto-generated method stub
+ return new NsaSimpleApiKey(arg0, arg1);
+ }
+
+ @Override
+ public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean deleteApiKey(String arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {
+ Map<String, NsaSimpleApiKey> map = new HashMap<String, NsaSimpleApiKey>();
+ map.put("testkey", new NsaSimpleApiKey("testkey", "password"));
+ map.put("admin", new NsaSimpleApiKey("admin", "password"));
+
+ return map;
+ }
+
+ @Override
+ public Set<String> loadAllKeys() throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ return keys;
+ }
+
+ @Override
+ public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {
+ if (!keys.contains(arg0)) {
+ return null;
+ }
+ return new NsaSimpleApiKey(arg0, "password");
+ }
+
+ @Override
+ public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {
+ // TODO Auto-generated method stub
+
+ }
+ };
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ TransactionObjTest.class, TrnRequestTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TransactionObjTest.class, TrnRequestTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-\r
-public class TransactionObjTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testAsJsonObject() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- \r
- try {\r
- obj.asJsonObject();\r
- \r
- } catch(NullPointerException e) {\r
- assertTrue(true);\r
- }\r
- \r
- }\r
- \r
- @Test\r
- public void testGetId() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getId();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetId() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setId("23");\r
- assertTrue(true);\r
- \r
- }\r
-\r
- @Test\r
- public void testGetCreateTime() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getCreateTime();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetCreateTime() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setCreateTime("12:00:00");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSerialize() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.serialize();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetTotalMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getTotalMessageCount();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetTotalMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setTotalMessageCount(200);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetSuccessMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getSuccessMessageCount();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetSuccessMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setSuccessMessageCount(198);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetFailureMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getFailureMessageCount();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetFailureMessageCount() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setFailureMessageCount(2);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetfData() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getfData();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetfData() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setfData(null);\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetTrnRequest() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.getTrnRequest();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetTrnRequest() {\r
- TransactionObj obj = new TransactionObj("23", 100, 98, 2);\r
- obj.setTrnRequest(null);\r
- assertTrue(true);\r
- \r
- }\r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+
+public class TransactionObjTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testAsJsonObject() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+
+ try {
+ obj.asJsonObject();
+
+ } catch(NullPointerException e) {
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testGetId() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getId();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetId() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setId("23");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCreateTime() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getCreateTime();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetCreateTime() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setCreateTime("12:00:00");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSerialize() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.serialize();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTotalMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getTotalMessageCount();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTotalMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setTotalMessageCount(200);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetSuccessMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getSuccessMessageCount();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetSuccessMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setSuccessMessageCount(198);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetFailureMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getFailureMessageCount();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetFailureMessageCount() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setFailureMessageCount(2);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetfData() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getfData();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetfData() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setfData(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTrnRequest() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.getTrnRequest();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTrnRequest() {
+ TransactionObj obj = new TransactionObj("23", 100, 98, 2);
+ obj.setTrnRequest(null);
+ assertTrue(true);
+
+ }
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.transaction.TransactionObj;\r
-import com.att.dmf.mr.transaction.TrnRequest;\r
-\r
-public class TrnRequestTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetId() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getId();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetId() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setId("23");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetRequestCreate() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getRequestCreate();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetRequestCreate() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setRequestCreate("createRequest");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetRequestHost() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getRequestHost();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetRequestHost() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setRequestHost("requestHost");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetServerHost() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getServerHost();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetServerHost() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setServerHost("requestHost");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetMessageProceed() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getMessageProceed();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetMessageProceed() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setMessageProceed("messageProceed");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetTotalMessage() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getTotalMessage();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetTotalMessage() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setTotalMessage("200");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- \r
- @Test\r
- public void testGetClientType() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getClientType();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetClientType() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setClientType("admin");\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testGetUrl() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.getUrl();\r
- assertTrue(true);\r
- \r
- }\r
- \r
- @Test\r
- public void testSetUrl() {\r
- TrnRequest req = new TrnRequest();\r
- \r
- req.setUrl("http://google.com");\r
- assertTrue(true);\r
- \r
- }\r
- \r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
+import org.onap.dmaap.dmf.mr.transaction.TrnRequest;
+
+public class TrnRequestTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetId() {
+ TrnRequest req = new TrnRequest();
+
+ req.getId();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetId() {
+ TrnRequest req = new TrnRequest();
+
+ req.setId("23");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetRequestCreate() {
+ TrnRequest req = new TrnRequest();
+
+ req.getRequestCreate();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetRequestCreate() {
+ TrnRequest req = new TrnRequest();
+
+ req.setRequestCreate("createRequest");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetRequestHost() {
+ TrnRequest req = new TrnRequest();
+
+ req.getRequestHost();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetRequestHost() {
+ TrnRequest req = new TrnRequest();
+
+ req.setRequestHost("requestHost");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetServerHost() {
+ TrnRequest req = new TrnRequest();
+
+ req.getServerHost();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetServerHost() {
+ TrnRequest req = new TrnRequest();
+
+ req.setServerHost("requestHost");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetMessageProceed() {
+ TrnRequest req = new TrnRequest();
+
+ req.getMessageProceed();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMessageProceed() {
+ TrnRequest req = new TrnRequest();
+
+ req.setMessageProceed("messageProceed");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTotalMessage() {
+ TrnRequest req = new TrnRequest();
+
+ req.getTotalMessage();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTotalMessage() {
+ TrnRequest req = new TrnRequest();
+
+ req.setTotalMessage("200");
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testGetClientType() {
+ TrnRequest req = new TrnRequest();
+
+ req.getClientType();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetClientType() {
+ TrnRequest req = new TrnRequest();
+
+ req.setClientType("admin");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetUrl() {
+ TrnRequest req = new TrnRequest();
+
+ req.getUrl();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetUrl() {
+ TrnRequest req = new TrnRequest();
+
+ req.setUrl("http://google.com");
+ assertTrue(true);
+
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction.impl;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;\r
-\r
-public class DMaaPSimpleTransactionFactoryTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testMakeNewTransactionObj() {\r
- \r
- DMaaPSimpleTransactionFactory factory = new DMaaPSimpleTransactionFactory();\r
- \r
- factory.makeNewTransactionObj("{'transactionId': '123', 'totalMessageCount': '200', "\r
- + "'successMessageCount': '200', 'failureMessageCount': '0'}");\r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- \r
- }\r
- \r
- @Test\r
- public void testMakeNewTransactionId() {\r
- \r
- DMaaPSimpleTransactionFactory factory = new DMaaPSimpleTransactionFactory();\r
- factory.makeNewTransactionId("123");\r
- \r
- String trueValue = "True";\r
- assertTrue(trueValue.equalsIgnoreCase("True"));\r
- \r
- }\r
- \r
- \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction.impl;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.dmf.mr.transaction.impl.DMaaPSimpleTransactionFactory;
+
+public class DMaaPSimpleTransactionFactoryTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testMakeNewTransactionObj() {
+
+ DMaaPSimpleTransactionFactory factory = new DMaaPSimpleTransactionFactory();
+
+ factory.makeNewTransactionObj("{'transactionId': '123', 'totalMessageCount': '200', "
+ + "'successMessageCount': '200', 'failureMessageCount': '0'}");
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+
+ }
+
+ @Test
+ public void testMakeNewTransactionId() {
+
+ DMaaPSimpleTransactionFactory factory = new DMaaPSimpleTransactionFactory();
+ factory.makeNewTransactionId("123");
+
+ String trueValue = "True";
+ assertTrue(trueValue.equalsIgnoreCase("True"));
+
+ }
+
+
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.transaction.impl;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ DMaaPSimpleTransactionFactoryTest.class, })\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction.impl;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ DMaaPSimpleTransactionFactoryTest.class, })
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.transaction.impl;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.utils;\r
-\r
-import static org.junit.Assert.assertNotNull;\r
-\r
-import org.junit.After;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.cambria.embed.EmbedConfigurationReader;\r
-import com.att.dmf.mr.utils.ConfigurationReader;\r
-\r
-public class ConfigurationReaderTest {\r
-\r
- EmbedConfigurationReader embedConfigurationReader = new EmbedConfigurationReader();\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- embedConfigurationReader.tearDown();\r
- }\r
-\r
- @Test\r
- public void testConfigurationReader() throws Exception {\r
- \r
- ConfigurationReader configurationReader = embedConfigurationReader.buildConfigurationReader();\r
- \r
- assertNotNull(configurationReader);\r
- assertNotNull(configurationReader.getfApiKeyDb());\r
- assertNotNull(configurationReader.getfConfigDb());\r
- assertNotNull(configurationReader.getfConsumerFactory());\r
- assertNotNull(configurationReader.getfIpBlackList());\r
- assertNotNull(configurationReader.getfMetaBroker());\r
- assertNotNull(configurationReader.getfMetrics());\r
- assertNotNull(configurationReader.getfPublisher());\r
- assertNotNull(configurationReader.getfSecurityManager());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.utils;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.After;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.cambria.embed.EmbedConfigurationReader;
+import org.onap.dmaap.dmf.mr.utils.ConfigurationReader;
+
+public class ConfigurationReaderTest {
+
+ EmbedConfigurationReader embedConfigurationReader = new EmbedConfigurationReader();
+
+ @After
+ public void tearDown() throws Exception {
+ embedConfigurationReader.tearDown();
+ }
+
+ @Test
+ public void testConfigurationReader() throws Exception {
+
+ ConfigurationReader configurationReader = embedConfigurationReader.buildConfigurationReader();
+
+ assertNotNull(configurationReader);
+ assertNotNull(configurationReader.getfApiKeyDb());
+ assertNotNull(configurationReader.getfConfigDb());
+ assertNotNull(configurationReader.getfConsumerFactory());
+ assertNotNull(configurationReader.getfIpBlackList());
+ assertNotNull(configurationReader.getfMetaBroker());
+ assertNotNull(configurationReader.getfMetrics());
+ assertNotNull(configurationReader.getfPublisher());
+ assertNotNull(configurationReader.getfSecurityManager());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.utils;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.File;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.apache.curator.framework.CuratorFramework;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.ajsc.filemonitor.AJSCPropertiesMap;\r
-import com.att.dmf.mr.constants.CambriaConstants;\r
-import com.att.dmf.mr.utils.DMaaPCuratorFactory;\r
-import com.att.dmf.mr.utils.PropertyReader;\r
-import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;\r
-import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;\r
-import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;\r
-\r
-public class DMaaPCuratorFactoryTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- ClassLoader classLoader = getClass().getClassLoader(); \r
- AJSCPropertiesMap.refresh(new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()));\r
- \r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testgetCurator() throws loadException {\r
- CuratorFramework curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());\r
- assertNotNull(curatorFramework);\r
- \r
- Map<String, String> map = com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperties(CambriaConstants.msgRtr_prop);\r
- map.remove(CambriaConstants.kSetting_ZkConfigDbServers);\r
- map.remove(CambriaConstants.kSetting_ZkSessionTimeoutMs);\r
- \r
- \r
- \r
- curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());\r
- assertNotNull(curatorFramework);\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.utils;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.ajsc.filemonitor.AJSCPropertiesMap;
+import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
+import org.onap.dmaap.dmf.mr.utils.DMaaPCuratorFactory;
+import org.onap.dmaap.dmf.mr.utils.PropertyReader;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;
+import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;
+import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;
+
+public class DMaaPCuratorFactoryTest {
+
+ @Before
+ public void setUp() throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+ AJSCPropertiesMap.refresh(new File(classLoader.getResource(CambriaConstants.msgRtr_prop).getFile()));
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testgetCurator() throws loadException {
+ CuratorFramework curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());
+ assertNotNull(curatorFramework);
+
+ Map<String, String> map = com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperties(CambriaConstants.msgRtr_prop);
+ map.remove(CambriaConstants.kSetting_ZkConfigDbServers);
+ map.remove(CambriaConstants.kSetting_ZkSessionTimeoutMs);
+
+
+
+ curatorFramework = DMaaPCuratorFactory.getCurator(new PropertyReader());
+ assertNotNull(curatorFramework);
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.utils;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import org.json.JSONException;\r
-import org.json.JSONObject;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.springframework.mock.web.MockHttpServletRequest;\r
-import org.springframework.mock.web.MockHttpServletResponse;\r
-\r
-import com.att.dmf.mr.beans.DMaaPContext;\r
-import com.att.dmf.mr.utils.DMaaPResponseBuilder;\r
-\r
-public class DMaaPResponseBuilderTest {\r
- \r
- DMaaPContext dMaapContext;\r
- MockHttpServletRequest request;\r
- MockHttpServletResponse response;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- \r
- dMaapContext = new DMaaPContext();\r
- request = new MockHttpServletRequest();\r
- response = new MockHttpServletResponse();\r
- dMaapContext.setRequest(request);\r
- dMaapContext.setResponse(response);\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testsetNoCacheHeadings(){ \r
- DMaaPResponseBuilder.setNoCacheHeadings(dMaapContext); \r
- assertEquals("no-cache", response.getHeader("Pragma"));\r
- }\r
- \r
- @Test\r
- public void testrespondOk() throws JSONException, IOException{\r
- JSONObject jsonObject = new JSONObject();\r
- jsonObject.put("Name", "Test");\r
- \r
- DMaaPResponseBuilder.respondOk(dMaapContext, jsonObject);\r
- assertEquals("application/json", response.getContentType());\r
- assertEquals(200, response.getStatus());\r
- \r
- request.setMethod("HEAD");\r
- \r
- DMaaPResponseBuilder.respondOk(dMaapContext, jsonObject);\r
- assertEquals("application/json", response.getContentType());\r
- assertEquals(200, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testrespondOkNoContent(){\r
- DMaaPResponseBuilder.respondOkNoContent(dMaapContext);\r
- assertEquals(204, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testrespondOkWithHtml(){\r
- DMaaPResponseBuilder.respondOkWithHtml(dMaapContext, "<head></head>");\r
- \r
- assertEquals("text/html", response.getContentType());\r
- assertEquals(200, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testrespondWithError(){\r
- DMaaPResponseBuilder.respondWithError(dMaapContext, 500, "InternalServerError");\r
- assertEquals(500, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testrespondWithJsonError(){\r
- JSONObject o = new JSONObject();\r
- o.put("status", 500);\r
- o.put("message", "InternalServerError");\r
- DMaaPResponseBuilder.respondWithError(dMaapContext, 500, o);\r
- assertEquals(500, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testrespondWithErrorInJson(){\r
- DMaaPResponseBuilder.respondWithErrorInJson(dMaapContext, 500, "InternalServerError");\r
- \r
- assertEquals("application/json", response.getContentType());\r
- assertEquals(500, response.getStatus());\r
- }\r
- \r
- @Test\r
- public void testsendErrorAndBody(){\r
- DMaaPResponseBuilder.sendErrorAndBody(dMaapContext, 500, "InternalServerError", "text/html");\r
- \r
- assertEquals("text/html", response.getContentType());\r
- assertEquals(500, response.getStatus());\r
- \r
- request.setMethod("HEAD");\r
- \r
- DMaaPResponseBuilder.sendErrorAndBody(dMaapContext, 500, "InternalServerError", "text/html");\r
- \r
- assertEquals("text/html", response.getContentType());\r
- assertEquals(500, response.getStatus());\r
- \r
- }\r
- \r
- @Test\r
- public void testgetStreamForBinaryResponse() throws IOException{\r
- DMaaPResponseBuilder.getStreamForBinaryResponse(dMaapContext);\r
- \r
- assertEquals("application/octet-stream", response.getContentType());\r
- assertEquals(200, response.getStatus());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+ package org.onap.dmaap.mr.cambria.utils;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.utils.DMaaPResponseBuilder;
+
+public class DMaaPResponseBuilderTest {
+
+ DMaaPContext dMaapContext;
+ MockHttpServletRequest request;
+ MockHttpServletResponse response;
+
+ @Before
+ public void setUp() throws Exception {
+
+ dMaapContext = new DMaaPContext();
+ request = new MockHttpServletRequest();
+ response = new MockHttpServletResponse();
+ dMaapContext.setRequest(request);
+ dMaapContext.setResponse(response);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testsetNoCacheHeadings(){
+ DMaaPResponseBuilder.setNoCacheHeadings(dMaapContext);
+ assertEquals("no-cache", response.getHeader("Pragma"));
+ }
+
+ @Test
+ public void testrespondOk() throws JSONException, IOException{
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("Name", "Test");
+
+ DMaaPResponseBuilder.respondOk(dMaapContext, jsonObject);
+ assertEquals("application/json", response.getContentType());
+ assertEquals(200, response.getStatus());
+
+ request.setMethod("HEAD");
+
+ DMaaPResponseBuilder.respondOk(dMaapContext, jsonObject);
+ assertEquals("application/json", response.getContentType());
+ assertEquals(200, response.getStatus());
+ }
+
+ @Test
+ public void testrespondOkNoContent(){
+ DMaaPResponseBuilder.respondOkNoContent(dMaapContext);
+ assertEquals(204, response.getStatus());
+ }
+
+ @Test
+ public void testrespondOkWithHtml(){
+ DMaaPResponseBuilder.respondOkWithHtml(dMaapContext, "<head></head>");
+
+ assertEquals("text/html", response.getContentType());
+ assertEquals(200, response.getStatus());
+ }
+
+ @Test
+ public void testrespondWithError(){
+ DMaaPResponseBuilder.respondWithError(dMaapContext, 500, "InternalServerError");
+ assertEquals(500, response.getStatus());
+ }
+
+ @Test
+ public void testrespondWithJsonError(){
+ JSONObject o = new JSONObject();
+ o.put("status", 500);
+ o.put("message", "InternalServerError");
+ DMaaPResponseBuilder.respondWithError(dMaapContext, 500, o);
+ assertEquals(500, response.getStatus());
+ }
+
+ @Test
+ public void testrespondWithErrorInJson(){
+ DMaaPResponseBuilder.respondWithErrorInJson(dMaapContext, 500, "InternalServerError");
+
+ assertEquals("application/json", response.getContentType());
+ assertEquals(500, response.getStatus());
+ }
+
+ @Test
+ public void testsendErrorAndBody(){
+ DMaaPResponseBuilder.sendErrorAndBody(dMaapContext, 500, "InternalServerError", "text/html");
+
+ assertEquals("text/html", response.getContentType());
+ assertEquals(500, response.getStatus());
+
+ request.setMethod("HEAD");
+
+ DMaaPResponseBuilder.sendErrorAndBody(dMaapContext, 500, "InternalServerError", "text/html");
+
+ assertEquals("text/html", response.getContentType());
+ assertEquals(500, response.getStatus());
+
+ }
+
+ @Test
+ public void testgetStreamForBinaryResponse() throws IOException{
+ DMaaPResponseBuilder.getStreamForBinaryResponse(dMaapContext);
+
+ assertEquals("application/octet-stream", response.getContentType());
+ assertEquals(200, response.getStatus());
+ }
+
+}
* ============LICENSE_END=========================================================
*/
-package com.att.nsa.cambria.utils;
+ package org.onap.dmaap.mr.cambria.utils;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
-import com.att.dmf.mr.beans.DMaaPContext;
-import com.att.dmf.mr.utils.Utils;
+import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
+import org.onap.dmaap.dmf.mr.utils.Utils;
public class UtilsTest {
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.filter;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import javax.servlet.ServletException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.mr.filter.ContentLengthFilter;\r
-\r
-public class ContentLengthFilterTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testDestroy() {\r
- ContentLengthFilter filter = new ContentLengthFilter();\r
- \r
- filter.destroy();\r
- \r
- assertTrue(true);\r
- }\r
- \r
- \r
- @Test\r
- public void testFilter() {\r
- ContentLengthFilter filter = new ContentLengthFilter();\r
- \r
- try {\r
- filter.doFilter(null, null, null);\r
- } catch (IOException | ServletException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\r
- \r
- \r
- }\r
- \r
- @Test\r
- public void testInit() {\r
- ContentLengthFilter filter = new ContentLengthFilter();\r
- \r
- try {\r
- filter.init(null);\r
- } catch (ServletException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (NullPointerException e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- } \r
- \r
- }\r
-\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.filter;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.filter.ContentLengthFilter;
+
+public class ContentLengthFilterTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testDestroy() {
+ ContentLengthFilter filter = new ContentLengthFilter();
+
+ filter.destroy();
+
+ assertTrue(true);
+ }
+
+
+ @Test
+ public void testFilter() {
+ ContentLengthFilter filter = new ContentLengthFilter();
+
+ try {
+ filter.doFilter(null, null, null);
+ } catch (IOException | ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+
+ }
+
+ @Test
+ public void testInit() {
+ ContentLengthFilter filter = new ContentLengthFilter();
+
+ try {
+ filter.init(null);
+ } catch (ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // TODO Auto-generated catch block
+ assertTrue(true);
+ }
+
+ }
+
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.filter;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import java.io.IOException;\r
-\r
-import javax.servlet.ServletException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.mr.filter.DefaultLength;\r
-\r
-public class DefaultLengthTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
- }\r
-\r
- @Test\r
- public void testGetDefaultLength() {\r
- DefaultLength length = new DefaultLength();\r
- \r
- length.getDefaultLength();\r
- \r
- assertTrue(true);\r
- }\r
- \r
- @Test\r
- public void testSetDefaultLength() {\r
- DefaultLength length = new DefaultLength();\r
- \r
- length.setDefaultLength("23");\r
- \r
- assertTrue(true);\r
- }\r
-\r
-\r
-\r
-\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.filter;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class DefaultLengthTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testGetDefaultLength() {
+ DefaultLength length = new DefaultLength();
+
+ length.getDefaultLength();
+
+ assertTrue(true);
+ }
+
+ @Test
+ public void testSetDefaultLength() {
+ DefaultLength length = new DefaultLength();
+
+ length.setDefaultLength("23");
+
+ assertTrue(true);
+ }
+
+
+
+
+
}
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.filter;\r
-\r
-import junit.framework.TestSuite;\r
-\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.Suite;\r
-import org.junit.runners.Suite.SuiteClasses;\r
-import org.apache.log4j.Logger;\r
-\r
-@RunWith(Suite.class)\r
-@SuiteClasses({ ContentLengthFilterTest.class, DefaultLengthTest.class,})\r
-public class JUnitTestSuite {\r
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
-\r
- public static void main(String[] args) {\r
- LOGGER.info("Running the test suite");\r
- \r
- TestSuite tstSuite = new TestSuite();\r
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.filter;
+
+import junit.framework.TestSuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.apache.log4j.Logger;
+
+@RunWith(Suite.class)
+@SuiteClasses({ ContentLengthFilterTest.class, DefaultLengthTest.class,})
+public class JUnitTestSuite {
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
+
+ public static void main(String[] args) {
+ LOGGER.info("Running the test suite");
+
+ TestSuite tstSuite = new TestSuite();
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.att.nsa.cambria.listener;\r
-\r
-import org.junit.runner.JUnitCore;\r
-import org.junit.runner.Result;\r
-import org.junit.runner.notification.Failure;\r
-import org.apache.log4j.Logger;\r
-\r
-public class TestRunner {\r
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
-\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
- for (Failure failure : result.getFailures()) {\r
- LOGGER.info(failure.toString());\r
- \r
- }\r
- LOGGER.info(result.wasSuccessful());\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.mr.filter;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.apache.log4j.Logger;
+
+public class TestRunner {
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);
+ for (Failure failure : result.getFailures()) {
+ LOGGER.info(failure.toString());
+
+ }
+ LOGGER.info(result.wasSuccessful());
+ }
+
+}
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.Serializable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.InputStream;
import java.util.Scanner;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.InputStream;
import java.util.Properties;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.InputStream;
import java.util.Properties;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.InputStream;
import java.util.Scanner;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import junit.framework.TestSuite;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.IOException;
import java.io.InputStream;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
/**
*
*/
-package com.att.mr.test.dmaap;
+package org.onap.dmaap.mr.test.dmaap;
import java.io.Serializable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.io.Serializable;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.mr.test.dmaap.DmaapAdminTest;
//import com.ibm.disthub2.impl.client.PropSchema;
public class DME2AdminTest extends TestCase {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.mr.test.dmaap.DmaapAdminTest;
public class DME2ConsumerFilterTest extends TestCase {
private static final Logger LOGGER = Logger.getLogger(DME2ConsumerFilterTest.class);
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.mr.test.dmaap.DmaapAdminTest;
public class DME2ConsumerTest extends TestCase {
private static final Logger LOGGER = Logger.getLogger(DME2ConsumerTest.class);
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.mr.test.dmaap.DmaapAdminTest;
public class DME2MetricsTest extends TestCase {
private static final Logger LOGGER = Logger.getLogger(DME2MetricsTest.class);
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
import com.att.aft.dme2.internal.jackson.map.ObjectMapper;
-import com.att.mr.test.dmaap.DmaapAdminTest;
public class DME2ProducerTest extends TestCase {
- private static final Logger LOGGER = Logger.getLogger(DmaapAdminTest.class);
+ private static final Logger LOGGER = Logger.getLogger(DME2ProducerTest.class);
public void testProducer() {
DME2TopicTest topicTestObj = new DME2TopicTest();
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.net.URI;
import java.net.URISyntaxException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
import com.att.aft.dme2.internal.jackson.map.ObjectMapper;
-import com.att.mr.test.dmaap.DmaapAdminTest;
public class DME2TopicTest extends TestCase {
private String latitude;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import junit.framework.TestSuite;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.io.IOException;
import java.io.InputStream;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
/**
*
*/
-package com.att.mr.test.dme2;
+package org.onap.dmaap.mr.test.dme2;
import java.io.Serializable;