<groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
<artifactId>dmaapClient</artifactId>
<packaging>jar</packaging>
- <version>1.1.8-SNAPSHOT</version>
+ <version>1.1.9-SNAPSHOT</version>
<name>dmaap-messagerouter-dmaapclient</name>
<description>Client library for MR event routing API</description>
<url>https://github.com/att/dmaap-framework</url>
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.util.Collection;
import java.util.Iterator;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
/**
* A MR batching publisher is a publisher with additional functionality
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import org.slf4j.Logger;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.net.MalformedURLException;
import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.impl.MRConsumerImpl;
-import com.att.nsa.mr.client.impl.MRMetaClient;
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
+import org.onap.dmaap.mr.client.impl.MRConsumerImpl;
+import org.onap.dmaap.mr.client.impl.MRMetaClient;
+import org.onap.dmaap.mr.client.impl.MRSimplerBatchPublisher;
/**
* A collection of builders for various types of MR API clients
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.File;
import java.io.FileNotFoundException;
import javax.ws.rs.core.MultivaluedMap;
-import com.att.nsa.mr.client.impl.MRConsumerImpl;
-import com.att.nsa.mr.client.impl.MRMetaClient;
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
-import com.att.nsa.mr.tools.ValidatorUtil;
+import org.onap.dmaap.mr.client.impl.MRConsumerImpl;
+import org.onap.dmaap.mr.client.impl.MRMetaClient;
+import org.onap.dmaap.mr.client.impl.MRSimplerBatchPublisher;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.tools.ValidatorUtil;
/**
* A factory for MR clients.<br/>
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.IOException;
-import com.att.nsa.mr.client.response.MRConsumerResponse;
+import org.onap.dmaap.mr.client.response.MRConsumerResponse;
public interface MRConsumer extends MRClient
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.IOException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.IOException;
import java.util.Collection;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client;
+package org.onap.dmaap.mr.client;
import java.io.IOException;
import java.util.Set;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
public class Clock
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.net.MalformedURLException;
import java.util.Collection;
import com.att.nsa.apiClient.http.CacheUse;
import com.att.nsa.apiClient.http.HttpClient;
-import com.att.nsa.mr.client.MRClient;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.client.MRClient;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
public class MRBaseClient extends HttpClient implements MRClient {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import com.att.nsa.apiClient.http.HttpClient;
import com.att.nsa.apiClient.http.HttpException;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
/**
* This is a batching publisher class that allows the client to publish messages
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.IOException;
import java.io.InputStream;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.response.MRConsumerResponse;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.response.MRConsumerResponse;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
enum MRFormat
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.IOException;
import java.net.MalformedURLException;
import com.att.nsa.apiClient.credentials.ApiCredential;
import com.att.nsa.apiClient.http.HttpException;
import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
-import com.att.nsa.mr.client.MRIdentityManager;
-import com.att.nsa.mr.client.MRTopicManager;
+import org.onap.dmaap.mr.client.MRIdentityManager;
+import org.onap.dmaap.mr.client.MRTopicManager;
public class MRMetaClient extends MRBaseClient implements MRTopicManager, MRIdentityManager
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import com.att.aft.dme2.api.DME2Client;
import com.att.aft.dme2.api.DME2Exception;
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
public class MRSimplerBatchPublisher extends MRBaseClient implements MRBatchingPublisher {
private static final Logger logger = LoggerFactory.getLogger(MRSimplerBatchPublisher.class);
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.response;
+package org.onap.dmaap.mr.client.response;
public class MRConsumerResponse {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.response;
+package org.onap.dmaap.mr.client.response;
/**
* Response for Publisher
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
import java.util.Map;
import com.att.aft.dme2.api.util.DME2ExchangeFaultContext;
import com.att.aft.dme2.api.util.DME2ExchangeReplyHandler;
import com.att.aft.dme2.api.util.DME2ExchangeResponseContext;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.impl.MRSimplerBatchPublisher;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStream;
import com.att.aft.dme2.api.util.DME2ExchangeFaultContext;
import com.att.aft.dme2.api.util.DME2ExchangeReplyHandler;
import com.att.aft.dme2.api.util.DME2ExchangeResponseContext;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.impl.MRSimplerBatchPublisher;
public class PreferredRouteReplyHandler implements DME2ExchangeReplyHandler {
private Logger fLog = LoggerFactory.getLogger ( this.getClass().getName () );
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.att.aft.dme2.api.util.DME2ExchangeRequestContext;
import com.att.aft.dme2.api.util.DME2ExchangeRequestHandler;
-import com.att.nsa.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRClientFactory;
public class PreferredRouteRequestHandler implements DME2ExchangeRequestHandler {
private Logger logger = LoggerFactory.getLogger(this.getClass().getName());
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
import java.util.Map;
import javax.ws.rs.core.MultivaluedMap;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
import java.util.List;
*
*******************************************************************************/
-package com.att.nsa.mr.dme.client;
+package org.onap.dmaap.mr.dme.client;
import java.io.IOException;
import org.json.JSONObject;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRPublisher.message;
/**
* An example of how to use the Java publisher.
/**
*
*/
-package com.att.nsa.mr.logging;
+package org.onap.dmaap.mr.logging;
import java.io.IOException;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRPublisher;
/**
* @author author
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.BufferedReader;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRPublisher.message;
/**
* A simple publisher that reads from std in, sending each line as a message.
/**
*
*/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
/**
* @author author
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.util.LinkedList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
public class SampleConsumer {
private SampleConsumer() {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRClientBuilders.PublisherBuilder;
-import com.att.nsa.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRClientBuilders.PublisherBuilder;
+import org.onap.dmaap.mr.client.MRPublisher.message;
public class SamplePublisher {
public static void main ( String[] args ) throws IOException, InterruptedException
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.File;
import java.io.FileReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
public class SimpleExampleConsumer {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.File;
import java.io.FileReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.response.MRConsumerResponse;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.response.MRConsumerResponse;
public class SimpleExampleConsumerWithReturnResponse {
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.File;
import java.io.FileReader;
import org.json.JSONObject;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRPublisher.message;
/**
* An example of how to use the Java publisher.
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.clients;
+package org.onap.dmaap.mr.test.clients;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
/**
*An example of how to use the Java publisher.
* @author author
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.support;
+package org.onap.dmaap.mr.test.support;
import java.util.Collection;
import java.util.LinkedList;
import org.slf4j.Logger;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
/**
* A helper for unit testing systems that use a MRPublisher. When setting
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.test.support;
+package org.onap.dmaap.mr.test.support;
import java.io.IOException;
import java.util.LinkedList;
import org.slf4j.Logger;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.response.MRConsumerResponse;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.response.MRConsumerResponse;
/**
* A helper for unit testing systems that use a MRConsumer. When setting
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.IOException;
import java.io.PrintStream;
import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
import com.att.nsa.cmdtool.Command;
import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRIdentityManager;
-import com.att.nsa.mr.client.MRClient.MRApiException;
-import com.att.nsa.mr.client.MRIdentityManager.ApiKey;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRIdentityManager;
+import org.onap.dmaap.mr.client.MRClient.MRApiException;
+import org.onap.dmaap.mr.client.MRIdentityManager.ApiKey;
public class ApiKeyCommand implements Command<MRCommandContext>
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.PrintStream;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.PrintStream;
import com.att.nsa.cmdtool.Command;
import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.impl.MRConsumerImpl;
+import org.onap.dmaap.mr.client.impl.MRConsumerImpl;
public class ClusterCommand implements Command<MRCommandContext>
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.util.Collection;
import java.util.LinkedList;
import com.att.nsa.apiClient.http.HttpClient;
import com.att.nsa.apiClient.http.HttpTracer;
import com.att.nsa.cmdtool.CommandContext;
-import com.att.nsa.mr.client.MRClient;
+import org.onap.dmaap.mr.client.MRClient;
public class MRCommandContext implements CommandContext
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.IOException;
import com.att.nsa.cmdtool.CommandLineTool;
-import com.att.nsa.mr.client.impl.MRClientVersionInfo;
+import org.onap.dmaap.mr.client.impl.MRClientVersionInfo;
public class MRTool extends CommandLineTool<MRCommandContext>
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.IOException;
import java.io.PrintStream;
import com.att.nsa.cmdtool.Command;
import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.MRClientBuilders.PublisherBuilder;
-import com.att.nsa.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRClientBuilders.PublisherBuilder;
+import org.onap.dmaap.mr.client.MRPublisher.message;
public class MessageCommand implements Command<MRCommandContext>
{
* ============LICENSE_END=========================================================
*/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientBuilders.PublisherBuilder;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientBuilders.PublisherBuilder;
public final class ToolsUtil {
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.IOException;
import java.io.PrintStream;
import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
import com.att.nsa.cmdtool.Command;
import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRTopicManager;
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRTopicManager;
+import org.onap.dmaap.mr.client.MRTopicManager.TopicInfo;
public class TopicCommand implements Command<MRCommandContext>
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.io.PrintStream;
import java.net.URI;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import java.util.Properties;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
public class ValidatorUtil {
+++ /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.mr.client.response;\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.mr.test.clients;\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.mr.test.support;\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
-/*-\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.mr.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-\r
-public class HostSelectorTest {\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 testSelectBaseHost() {\r
- \r
- HostSelector selector = new HostSelector("host");\r
- \r
- selector.selectBaseHost();\r
- assertTrue(true);\r
- \r
-\r
- }\r
-\r
- @Test\r
- public void testReportReachabilityProblem() {\r
- \r
- HostSelector selector = new HostSelector("host");\r
- \r
- selector.reportReachabilityProblem(100, 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.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+
+public class HostSelectorTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testSelectBaseHost() {
+
+ HostSelector selector = new HostSelector("host");
+
+ selector.selectBaseHost();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testReportReachabilityProblem() {
+
+ HostSelector selector = new HostSelector("host");
+
+ selector.reportReachabilityProblem(100, 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.mr.client;\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({ HostSelectorTest.class, MRClientBuildersTest.class, MRClientFactoryTest.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.client;
+
+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({ HostSelectorTest.class, MRClientBuildersTest.class, MRClientFactoryTest.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
- * Modifications Copyright © 2018 IBM.\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.mr.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRClient;\r
-import com.att.nsa.mr.client.MRClientBuilders;\r
-\r
-public class MRClientBuildersTest {\r
-\r
- private Collection<String> hostSet = new ArrayList<String>();\r
- private MRClientBuilders.ConsumerBuilder builder = null;\r
- private MRClientBuilders.PublisherBuilder pBuilder = null;\r
- private String[] hostArray = new String[10];\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- for (int i = 0; i < 10; i++) {\r
- hostSet.add("host" + (i + 1));\r
- hostArray[i] = "host" + (i + 1);\r
- }\r
-\r
- builder = new MRClientBuilders.ConsumerBuilder();\r
-\r
- pBuilder = new MRClientBuilders.PublisherBuilder();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testUsingHosts() {\r
-\r
- builder.usingHosts("hostList");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testUsingHosts2() {\r
-\r
- builder.usingHosts(hostSet);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testOnTopic() {\r
-\r
- builder.onTopic("testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testKnownAs() {\r
-\r
- builder.knownAs("CG1", "23");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testAuthenticatedBy() {\r
-\r
- builder.authenticatedBy("apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testWaitAtServer() {\r
-\r
- builder.waitAtServer(100);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testReceivingAtMost() {\r
-\r
- builder.receivingAtMost(100);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testWithServerSideFilter() {\r
-\r
- builder.withServerSideFilter("filter");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testBuild() {\r
-\r
- try {\r
-\r
- builder.build();\r
- } catch (IllegalArgumentException e) {\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testUsingHosts3() {\r
-\r
- pBuilder.usingHosts("testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testUsingHosts4() {\r
-\r
- pBuilder.usingHosts(hostArray);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testUsingHosts5() {\r
-\r
- pBuilder.usingHosts(hostSet);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testOnTopic2() {\r
-\r
- pBuilder.onTopic("testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testLimitBatch() {\r
-\r
- pBuilder.limitBatch(100, 10);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testWithCompresion() {\r
-\r
- pBuilder.withCompresion();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testWithoutCompresion() {\r
-\r
- pBuilder.withoutCompresion();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testEnableCompresion() {\r
-\r
- pBuilder.enableCompresion(true);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testAuthenticatedBy2() {\r
-\r
- pBuilder.authenticatedBy("apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testBuild2() {\r
-\r
- try {\r
-\r
- pBuilder.build();\r
- } catch (IllegalArgumentException e) {\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void test$testInject() {\r
-\r
- try {\r
-\r
- MRClientBuilders.$testInject(builder.build());\r
- } catch (IllegalArgumentException e) {\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void test$testInject2() {\r
-\r
- try {\r
-\r
- MRClientBuilders.$testInject(pBuilder.build());\r
- } catch (IllegalArgumentException e) {\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
+ * 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.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRClient;
+import org.onap.dmaap.mr.client.MRClientBuilders;
+
+public class MRClientBuildersTest {
+
+ private Collection<String> hostSet = new ArrayList<String>();
+ private MRClientBuilders.ConsumerBuilder builder = null;
+ private MRClientBuilders.PublisherBuilder pBuilder = null;
+ private String[] hostArray = new String[10];
+
+ @Before
+ public void setUp() throws Exception {
+
+ for (int i = 0; i < 10; i++) {
+ hostSet.add("host" + (i + 1));
+ hostArray[i] = "host" + (i + 1);
+ }
+
+ builder = new MRClientBuilders.ConsumerBuilder();
+
+ pBuilder = new MRClientBuilders.PublisherBuilder();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testUsingHosts() {
+
+ builder.usingHosts("hostList");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testUsingHosts2() {
+
+ builder.usingHosts(hostSet);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testOnTopic() {
+
+ builder.onTopic("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testKnownAs() {
+
+ builder.knownAs("CG1", "23");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAuthenticatedBy() {
+
+ builder.authenticatedBy("apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testWaitAtServer() {
+
+ builder.waitAtServer(100);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testReceivingAtMost() {
+
+ builder.receivingAtMost(100);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testWithServerSideFilter() {
+
+ builder.withServerSideFilter("filter");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testBuild() {
+
+ try {
+
+ builder.build();
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testUsingHosts3() {
+
+ pBuilder.usingHosts("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testUsingHosts4() {
+
+ pBuilder.usingHosts(hostArray);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testUsingHosts5() {
+
+ pBuilder.usingHosts(hostSet);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testOnTopic2() {
+
+ pBuilder.onTopic("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testLimitBatch() {
+
+ pBuilder.limitBatch(100, 10);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testWithCompresion() {
+
+ pBuilder.withCompresion();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testWithoutCompresion() {
+
+ pBuilder.withoutCompresion();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testEnableCompresion() {
+
+ pBuilder.enableCompresion(true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAuthenticatedBy2() {
+
+ pBuilder.authenticatedBy("apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testBuild2() {
+
+ try {
+
+ pBuilder.build();
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void test$testInject() {
+
+ try {
+
+ MRClientBuilders.$testInject(builder.build());
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void test$testInject2() {
+
+ try {
+
+ MRClientBuilders.$testInject(pBuilder.build());
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP Policy Engine\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Modifications Copyright © 2018 IBM.\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.mr.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRClient;\r
-import com.att.nsa.mr.client.MRClientBuilders;\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-\r
-public class MRClientFactoryTest {\r
-\r
- private Collection<String> hostSet = new ArrayList<String>();\r
-\r
- private String[] hostArray = new String[10];\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- for (int i = 0; i < 10; i++) {\r
- hostSet.add("host" + (i + 1));\r
- hostArray[i] = "host" + (i + 1);\r
- }\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer() {\r
-\r
- MRClientFactory.createConsumer("hostList hostList2", "testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer2() {\r
-\r
- MRClientFactory.createConsumer(hostSet, "testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer3() {\r
-\r
- MRClientFactory.createConsumer(hostSet, "testTopic", "filter");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer4() {\r
-\r
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer5() {\r
-\r
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer6() {\r
-\r
- MRClientFactory.createConsumer("hostList", "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer7() {\r
-\r
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateSimplePublisher() {\r
-\r
- MRClientFactory.createSimplePublisher("hostList", "testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher1() {\r
-\r
- MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher2() {\r
-\r
- MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10, true);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher3() {\r
-\r
- MRClientFactory.createBatchingPublisher(hostArray, "testTopic", 100, 10, true);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher4() {\r
-\r
- MRClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 10, true);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher5() {\r
-\r
- MRClientFactory.createBatchingPublisher("host", "testTopic", "username", "password", 100, 10, true,\r
- "protocolFlag");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateBatchingPublisher6() {\r
-\r
- try {\r
- MRClientFactory.createBatchingPublisher("/producer");\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 testCreateBatchingPublisher7() {\r
-\r
- try {\r
- MRClientFactory.createBatchingPublisher("/producer", true);\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 testCreateIdentityManager() {\r
-\r
- MRClientFactory.createIdentityManager(hostSet, "apikey", "apisecret");\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateTopicManager() {\r
-\r
- MRClientFactory.createTopicManager(hostSet, "apikey", "apisecret");\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer8() {\r
-\r
- try {\r
- MRClientFactory.createConsumer("/consumer");\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer9() {\r
-\r
- MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", "protocolFlag",\r
- "/consumer", 1, 2);\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCreateConsumer10() {\r
-\r
- MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", 1, 2, "protocolFlag",\r
- "/consumer");\r
-\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void test$testInject() {\r
-\r
- MRClientFactory.$testInject(null);\r
- assertTrue(true);\r
-\r
- }\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
+ * 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.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRClient;
+import org.onap.dmaap.mr.client.MRClientBuilders;
+import org.onap.dmaap.mr.client.MRClientFactory;
+
+public class MRClientFactoryTest {
+
+ private Collection<String> hostSet = new ArrayList<String>();
+
+ private String[] hostArray = new String[10];
+
+ @Before
+ public void setUp() throws Exception {
+
+ for (int i = 0; i < 10; i++) {
+ hostSet.add("host" + (i + 1));
+ hostArray[i] = "host" + (i + 1);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testCreateConsumer() {
+
+ MRClientFactory.createConsumer("hostList hostList2", "testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer2() {
+
+ MRClientFactory.createConsumer(hostSet, "testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer3() {
+
+ MRClientFactory.createConsumer(hostSet, "testTopic", "filter");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer4() {
+
+ MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer5() {
+
+ MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer6() {
+
+ MRClientFactory.createConsumer("hostList", "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer7() {
+
+ MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateSimplePublisher() {
+
+ MRClientFactory.createSimplePublisher("hostList", "testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher1() {
+
+ MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher2() {
+
+ MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher3() {
+
+ MRClientFactory.createBatchingPublisher(hostArray, "testTopic", 100, 10, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher4() {
+
+ MRClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 10, true);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher5() {
+
+ MRClientFactory.createBatchingPublisher("host", "testTopic", "username", "password", 100, 10, true,
+ "protocolFlag");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher6() {
+
+ try {
+ MRClientFactory.createBatchingPublisher("/producer");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateBatchingPublisher7() {
+
+ try {
+ MRClientFactory.createBatchingPublisher("/producer", true);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateIdentityManager() {
+
+ MRClientFactory.createIdentityManager(hostSet, "apikey", "apisecret");
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateTopicManager() {
+
+ MRClientFactory.createTopicManager(hostSet, "apikey", "apisecret");
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer8() {
+
+ try {
+ MRClientFactory.createConsumer("/consumer");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer9() {
+
+ MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", "protocolFlag",
+ "/consumer", 1, 2);
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCreateConsumer10() {
+
+ MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", 1, 2, "protocolFlag",
+ "/consumer");
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void test$testInject() {
+
+ MRClientFactory.$testInject(null);
+ 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.mr.tools;\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.client;
+
+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.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import static org.junit.Assert.assertEquals;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.IOException;
import java.util.Arrays;
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.http.HttpHost;
import org.junit.Test;
-import com.att.nsa.mr.client.impl.MRConstants;
+import org.onap.dmaap.mr.client.impl.MRConstants;
public class MRConstantsTest extends TestCase
{
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.mr.client.impl;
+package org.onap.dmaap.mr.client.impl;
import java.io.IOException;
import java.util.LinkedList;
import org.junit.Test;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.impl.MRConstants;
-import com.att.nsa.mr.client.impl.MRConsumerImpl;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.impl.MRConstants;
+import org.onap.dmaap.mr.client.impl.MRConsumerImpl;
public class MRConsumerImplTest extends TestCase
{
-/*******************************************************************************\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
-package com.att.nsa.mr.client.impl;\r
-\r
-import java.io.IOException;\r
-import java.net.MalformedURLException;\r
-import java.util.Collection;\r
-import java.util.LinkedList;\r
-import java.util.Set;\r
-\r
-import org.junit.Before;\r
-import org.junit.Rule;\r
-import org.junit.Test;\r
-\r
-import static com.github.tomakehurst.wiremock.client.WireMock.*;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import com.att.nsa.apiClient.http.HttpException;\r
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;\r
-import com.att.nsa.mr.client.MRClient.MRApiException;\r
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;\r
-import com.github.tomakehurst.wiremock.junit.WireMockRule;\r
-\r
-\r
-public class MRMetaClientTest {\r
- \r
- @Rule public WireMockRule wireMock = new WireMockRule();\r
- \r
- @Before\r
- public void setUp(){\r
- wireMock.stubFor(get(urlEqualTo("/topics"))\r
- .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));\r
- wireMock.stubFor(get(urlEqualTo("/topics/topic1"))\r
- .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));\r
- wireMock.stubFor(post(urlEqualTo("/topics/create"))\r
- .willReturn(aResponse().withStatus(200)));\r
- }\r
- \r
- @Test\r
- public void getTopicsTest() \r
- {\r
- final Collection<String> hosts = new LinkedList<String> ();\r
- hosts.add ( "localhost:" + wireMock.port() );\r
- \r
- MRMetaClient c;\r
- try {\r
- c = new MRMetaClient(hosts);\r
- Set<String> setString=c.getTopics();\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
- \r
- \r
- // assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );\r
- \r
- }\r
- \r
- @Test\r
- public void getTopicMetadataTest() {\r
- final Collection<String> hosts = new LinkedList<String> ();\r
- hosts.add ( "localhost:" + wireMock.port() );\r
- \r
- final String topic ="topic1";\r
- \r
- MRMetaClient c;\r
- try {\r
- c = new MRMetaClient(hosts);\r
- TopicInfo topicInfo=c.getTopicMetadata(topic);\r
- } catch (IOException | HttpObjectNotFoundException e) {\r
- e.printStackTrace();\r
- } \r
- \r
- }\r
- \r
- @Test\r
- public void testcreateTopic(){\r
- final Collection<String> hosts = new LinkedList<String> ();\r
- hosts.add ( "localhost:" + wireMock.port() );\r
- \r
- MRMetaClient c;\r
- try {\r
- c = new MRMetaClient(hosts);\r
- c.createTopic("topic1", "testTopic", 1, 1);\r
- } catch (IOException | HttpException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- @Test\r
- public void testupdateApiKey(){\r
- final Collection<String> hosts = new LinkedList<String> ();\r
- hosts.add ( "localhost:" + wireMock.port() );\r
- \r
- MRMetaClient c;\r
- try {\r
- c = new MRMetaClient(hosts);\r
- c.updateCurrentApiKey("test@onap.com", "test email");\r
- }catch (HttpException e) {\r
- \r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
- \r
- }\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.client.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static org.junit.Assert.assertTrue;
+
+import com.att.nsa.apiClient.http.HttpException;
+import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
+import org.onap.dmaap.mr.client.MRClient.MRApiException;
+import org.onap.dmaap.mr.client.MRTopicManager.TopicInfo;
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+
+public class MRMetaClientTest {
+
+ @Rule public WireMockRule wireMock = new WireMockRule();
+
+ @Before
+ public void setUp(){
+ wireMock.stubFor(get(urlEqualTo("/topics"))
+ .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));
+ wireMock.stubFor(get(urlEqualTo("/topics/topic1"))
+ .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));
+ wireMock.stubFor(post(urlEqualTo("/topics/create"))
+ .willReturn(aResponse().withStatus(200)));
+ }
+
+ @Test
+ public void getTopicsTest()
+ {
+ final Collection<String> hosts = new LinkedList<String> ();
+ hosts.add ( "localhost:" + wireMock.port() );
+
+ MRMetaClient c;
+ try {
+ c = new MRMetaClient(hosts);
+ Set<String> setString=c.getTopics();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ // assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );
+
+ }
+
+ @Test
+ public void getTopicMetadataTest() {
+ final Collection<String> hosts = new LinkedList<String> ();
+ hosts.add ( "localhost:" + wireMock.port() );
+
+ final String topic ="topic1";
+
+ MRMetaClient c;
+ try {
+ c = new MRMetaClient(hosts);
+ TopicInfo topicInfo=c.getTopicMetadata(topic);
+ } catch (IOException | HttpObjectNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testcreateTopic(){
+ final Collection<String> hosts = new LinkedList<String> ();
+ hosts.add ( "localhost:" + wireMock.port() );
+
+ MRMetaClient c;
+ try {
+ c = new MRMetaClient(hosts);
+ c.createTopic("topic1", "testTopic", 1, 1);
+ } catch (IOException | HttpException e) {
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testupdateApiKey(){
+ final Collection<String> hosts = new LinkedList<String> ();
+ hosts.add ( "localhost:" + wireMock.port() );
+
+ MRMetaClient c;
+ try {
+ c = new MRMetaClient(hosts);
+ c.updateCurrentApiKey("test@onap.com", "test email");
+ }catch (HttpException e) {
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (NullPointerException e) {
+ assertTrue(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.mr.client.impl;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.util.List;\r
-import java.util.Properties;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.json.JSONObject;\r
-import org.junit.After;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-import com.att.nsa.mr.client.MRConsumer;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.client.response.MRPublisherResponse;\r
-\r
-public class MRSimplerBatchConsumerTest {\r
- \r
- File outFile;\r
- @Before\r
- public void setUp() throws Exception {\r
- Properties properties = new Properties();\r
- properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));\r
- \r
- String routeFilePath="dme2/preferredRoute.txt";\r
- \r
- File file = new File(MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
- properties.put("DME2preferredRouterFilePath", MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
- \r
- outFile = new File(file.getParent() + "/consumer_tmp.properties");\r
- properties.store(new FileOutputStream(outFile), "");\r
- }\r
-\r
- @Test\r
- public void testSend() throws IOException, InterruptedException {\r
- \r
- final MRConsumer cc = MRClientFactory.createConsumer(outFile.getPath()); \r
- \r
- try {\r
- for(String msg : cc.fetch()){\r
- System.out.println(msg);\r
- }\r
- } catch (Exception e) {\r
- System.err.println ( e.getClass().getName () + ": " + e.getMessage () );\r
- } \r
- \r
- }\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.client.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
+
+public class MRSimplerBatchConsumerTest {
+
+ File outFile;
+ @Before
+ public void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+
+ String routeFilePath="dme2/preferredRoute.txt";
+
+ File file = new File(MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());
+ properties.put("DME2preferredRouterFilePath", MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());
+
+ outFile = new File(file.getParent() + "/consumer_tmp.properties");
+ properties.store(new FileOutputStream(outFile), "");
+ }
+
+ @Test
+ public void testSend() throws IOException, InterruptedException {
+
+ final MRConsumer cc = MRClientFactory.createConsumer(outFile.getPath());
+
+ try {
+ for(String msg : cc.fetch()){
+ System.out.println(msg);
+ }
+ } catch (Exception e) {
+ System.err.println ( e.getClass().getName () + ": " + e.getMessage () );
+ }
+
+ }
+
+
+}
-/*******************************************************************************\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.mr.client.impl;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.util.List;\r
-import java.util.Properties;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.json.JSONObject;\r
-import org.junit.After;\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.client.response.MRPublisherResponse;\r
-\r
-public class MRSimplerBatchPublisherTest {\r
- \r
- File outFile;\r
- @Before\r
- public void setUp() throws Exception {\r
- Properties properties = new Properties();\r
- properties.load(MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/producer.properties"));\r
- \r
- String routeFilePath="dme2/preferredRoute.txt";\r
- \r
- File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
- properties.put("DME2preferredRouterFilePath", MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
- \r
- outFile = new File(file.getParent() + "/producer_tmp.properties");\r
- properties.store(new FileOutputStream(outFile), "");\r
- }\r
-\r
- @Test\r
- public void testSend() throws IOException, InterruptedException {\r
- \r
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath()); \r
- \r
- //publish some messages\r
- final JSONObject msg1 = new JSONObject ();\r
- pub.send ( "MyPartitionKey", msg1.toString () );\r
-\r
- final List<message> stuck = pub.close ( 1, TimeUnit.SECONDS );\r
- if ( stuck.size () > 0 ) {\r
- System.out.println( stuck.size() + " messages unsent" );\r
- }\r
- else\r
- {\r
- System.out.println ( "Clean exit; all messages sent." );\r
- }\r
- \r
- \r
- }\r
-\r
- @Test\r
- public void testSendBatchWithResponse() throws IOException, InterruptedException {\r
- \r
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath(), true); \r
- \r
- //publish some messages\r
- final JSONObject msg1 = new JSONObject ();\r
- pub.send ( "MyPartitionKey", msg1.toString () );\r
- MRPublisherResponse pubResponse = new MRPublisherResponse();\r
- pub.setPubResponse(pubResponse);\r
- \r
- MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();\r
- Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());\r
- \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.client.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.client.response.MRPublisherResponse;
+
+public class MRSimplerBatchPublisherTest {
+
+ File outFile;
+ @Before
+ public void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.load(MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/producer.properties"));
+
+ String routeFilePath="dme2/preferredRoute.txt";
+
+ File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+ properties.put("DME2preferredRouterFilePath", MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+
+ outFile = new File(file.getParent() + "/producer_tmp.properties");
+ properties.store(new FileOutputStream(outFile), "");
+ }
+
+ @Test
+ public void testSend() throws IOException, InterruptedException {
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath());
+
+ //publish some messages
+ final JSONObject msg1 = new JSONObject ();
+ pub.send ( "MyPartitionKey", msg1.toString () );
+
+ final List<message> stuck = pub.close ( 1, TimeUnit.SECONDS );
+ if ( stuck.size () > 0 ) {
+ System.out.println( stuck.size() + " messages unsent" );
+ }
+ else
+ {
+ System.out.println ( "Clean exit; all messages sent." );
+ }
+
+
+ }
+
+ @Test
+ public void testSendBatchWithResponse() throws IOException, InterruptedException {
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath(), true);
+
+ //publish some messages
+ final JSONObject msg1 = new JSONObject ();
+ pub.send ( "MyPartitionKey", msg1.toString () );
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+}
-/*-\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.mr.client.response;\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({ MRConsumerResponseTest.class, MRPublisherResponseTest.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.client.response;
+
+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({ MRConsumerResponseTest.class, MRPublisherResponseTest.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.mr.client.response;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-\r
-public class MRConsumerResponseTest {\r
- private MRConsumerResponse test = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- test = new MRConsumerResponse();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetResponseCode() {\r
-\r
- test.getResponseCode();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetResponseCode() {\r
-\r
- test.setResponseCode("200");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetResponseMessage() {\r
-\r
- test.getResponseMessage();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetResponseMessage() {\r
-\r
- test.setResponseMessage("responseMessage");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetActualMessages() {\r
-\r
- test.getActualMessages();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetActualMessages() {\r
-\r
- test.setActualMessages(null);\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.client.response;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+
+public class MRConsumerResponseTest {
+ private MRConsumerResponse test = null;
+
+ @Before
+ public void setUp() throws Exception {
+ test = new MRConsumerResponse();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetResponseCode() {
+
+ test.getResponseCode();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetResponseCode() {
+
+ test.setResponseCode("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetResponseMessage() {
+
+ test.getResponseMessage();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetResponseMessage() {
+
+ test.setResponseMessage("responseMessage");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetActualMessages() {
+
+ test.getActualMessages();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetActualMessages() {
+
+ test.setActualMessages(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.mr.client.response;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-\r
-public class MRPublisherResponseTest {\r
- private MRPublisherResponse response = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- response = new MRPublisherResponse();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetResponseCode() {\r
-\r
- response.getResponseCode();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetResponseCode() {\r
-\r
- response.setResponseCode("200");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetResponseMessage() {\r
-\r
- response.getResponseMessage();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetResponseMessage() {\r
-\r
- response.setResponseMessage("responseMessage");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetPendingMsgs() {\r
-\r
- response.getPendingMsgs();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetPendingMsgs() {\r
-\r
- response.setPendingMsgs(5);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testToString() {\r
-\r
- response.toString();\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.client.response;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+
+public class MRPublisherResponseTest {
+ private MRPublisherResponse response = null;
+
+ @Before
+ public void setUp() throws Exception {
+ response = new MRPublisherResponse();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetResponseCode() {
+
+ response.getResponseCode();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetResponseCode() {
+
+ response.setResponseCode("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetResponseMessage() {
+
+ response.getResponseMessage();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetResponseMessage() {
+
+ response.setResponseMessage("responseMessage");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetPendingMsgs() {
+
+ response.getPendingMsgs();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPendingMsgs() {
+
+ response.setPendingMsgs(5);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testToString() {
+
+ response.toString();
+ 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.mr.client;\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.client.response;
+
+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.mr.dme.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class DefaultLoggingFailoverFaultHandlerTest {\r
- private DefaultLoggingFailoverFaultHandler handler = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- handler = new DefaultLoggingFailoverFaultHandler();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testHandleEndpointFailover() {\r
-\r
- /* handler.handleEndpointFailover(null);\r
- assertTrue(true);*/\r
-\r
- }\r
- \r
- @Test\r
- public void testHandleRouteOfferFailover() {\r
-\r
- /* handler.handleRouteOfferFailover(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.dme.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class DefaultLoggingFailoverFaultHandlerTest {
+ private DefaultLoggingFailoverFaultHandler handler = null;
+
+ @Before
+ public void setUp() throws Exception {
+ handler = new DefaultLoggingFailoverFaultHandler();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testHandleEndpointFailover() {
+
+ /* handler.handleEndpointFailover(null);
+ assertTrue(true);*/
+
+ }
+
+ @Test
+ public void testHandleRouteOfferFailover() {
+
+ /* handler.handleRouteOfferFailover(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.mr.dme.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class HeaderReplyHandlerTest {\r
- private HeaderReplyHandler handler = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- handler = new HeaderReplyHandler();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testHandleFault() {\r
-\r
- handler.handleFault(null);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testHandleEndpointFault() {\r
-\r
- handler.handleEndpointFault(null);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testHandleReply() {\r
-\r
- handler.handleReply(null);\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.dme.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class HeaderReplyHandlerTest {
+ private HeaderReplyHandler handler = null;
+
+ @Before
+ public void setUp() throws Exception {
+ handler = new HeaderReplyHandler();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testHandleFault() {
+
+ handler.handleFault(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testHandleEndpointFault() {
+
+ handler.handleEndpointFault(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testHandleReply() {
+
+ handler.handleReply(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.mr.dme.client;\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({ DefaultLoggingFailoverFaultHandlerTest.class, HeaderReplyHandlerTest.class,PreferredRouteReplyHandlerTest.class,\r
- PreferredRouteRequestHandlerTest.class,SimpleExamplePublisherTest.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.dme.client;
+
+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({ DefaultLoggingFailoverFaultHandlerTest.class, HeaderReplyHandlerTest.class,PreferredRouteReplyHandlerTest.class,
+ PreferredRouteRequestHandlerTest.class,SimpleExamplePublisherTest.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.mr.dme.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class PreferredRouteReplyHandlerTest {\r
- private PreferredRouteReplyHandler handler = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- handler = new PreferredRouteReplyHandler();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testHandleReply() {\r
-\r
-// handler.handleReply(null);\r
-// assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testHandleFault() {\r
-/*\r
- handler.handleFault(null);\r
- assertTrue(true);\r
-*/\r
- }\r
- \r
- @Test\r
- public void testHandleEndpointFault() {\r
-\r
-/* handler.handleEndpointFault(null);\r
- assertTrue(true);*/\r
-\r
- }\r
- \r
- @Test\r
- public void testRouteWriter() {\r
-/*\r
- handler.routeWriter("routeKey", "routeValue");\r
- assertTrue(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.dme.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class PreferredRouteReplyHandlerTest {
+ private PreferredRouteReplyHandler handler = null;
+
+ @Before
+ public void setUp() throws Exception {
+ handler = new PreferredRouteReplyHandler();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testHandleReply() {
+
+// handler.handleReply(null);
+// assertTrue(true);
+
+ }
+
+ @Test
+ public void testHandleFault() {
+/*
+ handler.handleFault(null);
+ assertTrue(true);
+*/
+ }
+
+ @Test
+ public void testHandleEndpointFault() {
+
+/* handler.handleEndpointFault(null);
+ assertTrue(true);*/
+
+ }
+
+ @Test
+ public void testRouteWriter() {
+/*
+ handler.routeWriter("routeKey", "routeValue");
+ 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.mr.dme.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class PreferredRouteRequestHandlerTest {\r
- private PreferredRouteRequestHandler handler = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- handler = new PreferredRouteRequestHandler();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testHandleRequest() {\r
-\r
- /* handler.handleRequest(null);\r
- assertTrue(true);*/\r
-\r
- }\r
-\r
- @Test\r
- public void testReadRoute() {\r
-\r
-// try {\r
-// handler.readRoute("routeKey");\r
-// } catch (NullPointerException e) {\r
-// assertTrue(true);\r
-// }\r
-//\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.dme.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class PreferredRouteRequestHandlerTest {
+ private PreferredRouteRequestHandler handler = null;
+
+ @Before
+ public void setUp() throws Exception {
+ handler = new PreferredRouteRequestHandler();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testHandleRequest() {
+
+ /* handler.handleRequest(null);
+ assertTrue(true);*/
+
+ }
+
+ @Test
+ public void testReadRoute() {
+
+// try {
+// handler.readRoute("routeKey");
+// } catch (NullPointerException e) {
+// assertTrue(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.mr.dme.client;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class SimpleExamplePublisherTest {\r
- private SimpleExamplePublisher pub = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- pub = new SimpleExamplePublisher();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testPublishMessage() {\r
-\r
- try {\r
- pub.publishMessage("/producer");\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\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.dme.client;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class SimpleExamplePublisherTest {
+ private SimpleExamplePublisher pub = null;
+
+ @Before
+ public void setUp() throws Exception {
+ pub = new SimpleExamplePublisher();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testPublishMessage() {
+
+ try {
+ pub.publishMessage("/producer");
+ } 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.mr.logging;\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.dme.client;
+
+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.mr.logging;\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({ MRAppenderTest.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.logging;
+
+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({ MRAppenderTest.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.mr.logging;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-\r
-public class MRAppenderTest {\r
- private MRAppender appender = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- appender = new MRAppender();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testClose() {\r
- try {\r
- appender.close();\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testRequiresLayout() {\r
-\r
- appender.requiresLayout();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testAppend() {\r
-\r
- try {\r
- appender.append(null);\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testActivateOptions() {\r
-\r
- appender.activateOptions();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetTopic() {\r
-\r
- appender.getTopic();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetTopic() {\r
-\r
- appender.setTopic("testTopic");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetPartition() {\r
-\r
- appender.getPartition();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetPartition() {\r
-\r
- appender.setPartition("partition");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetHosts() {\r
-\r
- appender.getHosts();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetHosts() {\r
-\r
- appender.setHosts("hosts");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMaxBatchSize() {\r
-\r
- appender.getMaxBatchSize();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetMaxBatchSize() {\r
-\r
- appender.setMaxBatchSize(20);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMaxAgeMs() {\r
-\r
- appender.getMaxAgeMs();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetMaxAgeMs() {\r
-\r
- appender.setMaxAgeMs(15);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testIsCompress() {\r
-\r
- appender.isCompress();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetCompress() {\r
-\r
- appender.setCompress(true);\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.logging;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+
+public class MRAppenderTest {
+ private MRAppender appender = null;
+
+ @Before
+ public void setUp() throws Exception {
+ appender = new MRAppender();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testClose() {
+ try {
+ appender.close();
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testRequiresLayout() {
+
+ appender.requiresLayout();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAppend() {
+
+ try {
+ appender.append(null);
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testActivateOptions() {
+
+ appender.activateOptions();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopic() {
+
+ appender.getTopic();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopic() {
+
+ appender.setTopic("testTopic");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetPartition() {
+
+ appender.getPartition();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPartition() {
+
+ appender.setPartition("partition");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetHosts() {
+
+ appender.getHosts();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetHosts() {
+
+ appender.setHosts("hosts");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetMaxBatchSize() {
+
+ appender.getMaxBatchSize();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMaxBatchSize() {
+
+ appender.setMaxBatchSize(20);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetMaxAgeMs() {
+
+ appender.getMaxAgeMs();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMaxAgeMs() {
+
+ appender.setMaxAgeMs(15);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testIsCompress() {
+
+ appender.isCompress();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetCompress() {
+
+ appender.setCompress(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.mr.dme.client;\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.logging;
+
+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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ConsolePublisherTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- ConsolePublisher.main(null);\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConsolePublisherTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ ConsolePublisher.main(null);
+ } 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.mr.test.clients;\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({ SimpleExamplePublisherTest.class, ProtocolTypeConstantsTest.class,\r
- SampleConsumerTest.class, SamplePublisherTest.class, SimpleExampleConsumerTest.class, ConsolePublisherTest.class,\r
- SimpleExamplePublisherWithResponseTest.class, SimpleExampleConsumerWithReturnResponseTest.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.test.clients;
+
+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({ SimpleExamplePublisherTest.class, ProtocolTypeConstantsTest.class,
+ SampleConsumerTest.class, SamplePublisherTest.class, SimpleExampleConsumerTest.class, ConsolePublisherTest.class,
+ SimpleExamplePublisherWithResponseTest.class, SimpleExampleConsumerWithReturnResponseTest.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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class ProtocolTypeConstantsTest {\r
- private ProtocolTypeConstants constants = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- // constants = new ProtocolTypeConstants();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetValue() {\r
-\r
- try {\r
- constants.getValue();\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProtocolTypeConstantsTest {
+ private ProtocolTypeConstants constants = null;
+
+ @Before
+ public void setUp() throws Exception {
+ // constants = new ProtocolTypeConstants();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetValue() {
+
+ try {
+ constants.getValue();
+ } 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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SampleConsumerTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SampleConsumer.main( new String[0]);\r
- } catch (Exception e) {\r
- assertTrue(true);\r
- }\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SampleConsumerTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SampleConsumer.main( new String[0]);
+ } catch (Exception e) {
+ assertTrue(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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SamplePublisherTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SamplePublisher.main( new String[0]);\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- assertTrue(true);\r
- }\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SamplePublisherTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SamplePublisher.main( new String[0]);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ assertTrue(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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SimpleExampleConsumerTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SimpleExampleConsumer.main(null);\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleExampleConsumerTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SimpleExampleConsumer.main(null);
+ } 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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SimpleExampleConsumerWithReturnResponseTest {\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SimpleExampleConsumerWithReturnResponse.main(null);\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block e.printStackTrace();\r
- }\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleExampleConsumerWithReturnResponseTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SimpleExampleConsumerWithReturnResponse.main(null);
+ } 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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SimpleExamplePublisherTest {\r
- private SimpleExamplePublisher pub = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- pub = new SimpleExamplePublisher();\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testPublishMessage() {\r
- try {\r
- pub.publishMessage("/producer");\r
- } catch (NullPointerException e) {\r
- assertTrue(true);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (InterruptedException 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
-\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SimpleExamplePublisher.main(null);\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleExamplePublisherTest {
+ private SimpleExamplePublisher pub = null;
+
+ @Before
+ public void setUp() throws Exception {
+ pub = new SimpleExamplePublisher();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testPublishMessage() {
+ try {
+ pub.publishMessage("/producer");
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SimpleExamplePublisher.main(null);
+ } 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.mr.test.clients;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-public class SimpleExamplePublisherWithResponseTest {\r
- \r
- private SimpleExamplePublisherWithResponse pub = null;\r
- \r
- @Before\r
- public void setUp() throws Exception {\r
- pub = new SimpleExamplePublisherWithResponse();\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testMain() {\r
-\r
- try {\r
- SimpleExamplePublisherWithResponse.main( new String[0]);\r
- } catch (Exception e) {\r
- assertTrue(true);\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testPublishMessage() {\r
-\r
- try {\r
- pub.publishMessage("/producer", 100);\r
- } catch (Exception 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.test.clients;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleExamplePublisherWithResponseTest {
+
+ private SimpleExamplePublisherWithResponse pub = null;
+
+ @Before
+ public void setUp() throws Exception {
+ pub = new SimpleExamplePublisherWithResponse();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testMain() {
+
+ try {
+ SimpleExamplePublisherWithResponse.main( new String[0]);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testPublishMessage() {
+
+ try {
+ pub.publishMessage("/producer", 100);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(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.test.clients;
+
+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.mr.test.support;\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({ MRBatchingPublisherMockTest.class, MRConsumerMockTest.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.test.support;
+
+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({ MRBatchingPublisherMockTest.class, MRConsumerMockTest.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.mr.test.support;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
-\r
-public class MRBatchingPublisherMockTest {\r
- private MRBatchingPublisherMock pub = null;\r
-\r
- private MRBatchingPublisherMock.Entry entry = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- pub = new MRBatchingPublisherMock();\r
- entry = pub.new Entry("partition", "msg");\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testToString() {\r
-\r
- entry.toString();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testAddListener() {\r
-\r
- pub.addListener(null);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetCaptures() {\r
-\r
- pub.getCaptures();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetCaptures2() {\r
-\r
- pub.getCaptures(null);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testReceived() {\r
-\r
- pub.received();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testResend() {\r
-\r
- pub.reset();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSend() {\r
-\r
- pub.send("partition", "msg");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSend2() {\r
-\r
- pub.send("msg");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSend3() {\r
- //sending message m obj\r
- pub.send(new ArrayList<message>());\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSend4() {\r
- //sending collection of message m objects\r
- pub.send(new message("partition", "msg"));\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSendBatchWithResponse() {\r
-\r
- pub.sendBatchWithResponse();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testLogTo() {\r
-\r
- pub.logTo(null);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testClearApiCredentials() {\r
-\r
- pub.clearApiCredentials();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetApiCredentials() {\r
-\r
- pub.setApiCredentials("apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testClose() {\r
-\r
- pub.close();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testClose2() {\r
-\r
- pub.close(100, null);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetPendingMessageCount() {\r
-\r
- pub.getPendingMessageCount();\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.test.support;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Listener;
+
+public class MRBatchingPublisherMockTest {
+ private MRBatchingPublisherMock pub = null;
+
+ private MRBatchingPublisherMock.Entry entry = null;
+
+ @Before
+ public void setUp() throws Exception {
+ pub = new MRBatchingPublisherMock();
+ entry = pub.new Entry("partition", "msg");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testToString() {
+
+ entry.toString();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddListener() {
+
+ pub.addListener(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCaptures() {
+
+ pub.getCaptures();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCaptures2() {
+
+ pub.getCaptures(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testReceived() {
+
+ pub.received();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testResend() {
+
+ pub.reset();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSend() {
+
+ pub.send("partition", "msg");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSend2() {
+
+ pub.send("msg");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSend3() {
+ //sending message m obj
+ pub.send(new ArrayList<message>());
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSend4() {
+ //sending collection of message m objects
+ pub.send(new message("partition", "msg"));
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSendBatchWithResponse() {
+
+ pub.sendBatchWithResponse();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testLogTo() {
+
+ pub.logTo(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClearApiCredentials() {
+
+ pub.clearApiCredentials();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetApiCredentials() {
+
+ pub.setApiCredentials("apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClose() {
+
+ pub.close();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClose2() {
+
+ pub.close(100, null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetPendingMessageCount() {
+
+ pub.getPendingMessageCount();
+ 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.mr.test.support;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Entry;\r
-\r
-public class MRConsumerMockTest {\r
- private MRConsumerMock cons = null;\r
- private MRConsumerMock.Entry entry = null;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- cons = new MRConsumerMock();\r
- entry = cons.new Entry(100, 200, "statusMsg");\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testClose() {\r
-\r
- cons.close();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testRun() {\r
- try {\r
- entry.run();\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testSetApiCredentials() {\r
- cons.setApiCredentials("apikey", "apisecret");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testClearApiCredentials() {\r
- cons.clearApiCredentials();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAdd() {\r
- cons.add(entry);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAddImmediateMsg() {\r
- cons.addImmediateMsg("ImmediateMsg");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAddDelayedMsg() {\r
- cons.addDelayedMsg(100, "msg");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAddImmediateMsgGroup() {\r
- cons.addImmediateMsgGroup(new ArrayList<String>());\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAddDelayedMsgGroup() {\r
- cons.addDelayedMsgGroup(100,new ArrayList<String>());\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testAddImmediateError() {\r
- cons.addImmediateError(200, "OK");\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testFetch() {\r
- try {\r
- cons.fetch();\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 testFetch2() {\r
- try {\r
- cons.fetch(100, 200);\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 testLogTo() {\r
- cons.logTo(null);\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testFetchWithReturnConsumerResponse() {\r
- cons.fetchWithReturnConsumerResponse();\r
- assertTrue(true);\r
-\r
- }\r
- \r
- @Test\r
- public void testGetchWithReturnConsumerResponse() {\r
- cons.fetchWithReturnConsumerResponse(100,200);\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.test.support;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Entry;
+
+public class MRConsumerMockTest {
+ private MRConsumerMock cons = null;
+ private MRConsumerMock.Entry entry = null;
+
+ @Before
+ public void setUp() throws Exception {
+ cons = new MRConsumerMock();
+ entry = cons.new Entry(100, 200, "statusMsg");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testClose() {
+
+ cons.close();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testRun() {
+ try {
+ entry.run();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetApiCredentials() {
+ cons.setApiCredentials("apikey", "apisecret");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClearApiCredentials() {
+ cons.clearApiCredentials();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAdd() {
+ cons.add(entry);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddImmediateMsg() {
+ cons.addImmediateMsg("ImmediateMsg");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddDelayedMsg() {
+ cons.addDelayedMsg(100, "msg");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddImmediateMsgGroup() {
+ cons.addImmediateMsgGroup(new ArrayList<String>());
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddDelayedMsgGroup() {
+ cons.addDelayedMsgGroup(100,new ArrayList<String>());
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddImmediateError() {
+ cons.addImmediateError(200, "OK");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testFetch() {
+ try {
+ cons.fetch();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testFetch2() {
+ try {
+ cons.fetch(100, 200);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testLogTo() {
+ cons.logTo(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testFetchWithReturnConsumerResponse() {
+ cons.fetchWithReturnConsumerResponse();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetchWithReturnConsumerResponse() {
+ cons.fetchWithReturnConsumerResponse(100,200);
+ assertTrue(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.test.support;
+
+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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.io.PrintStream;\r
-import java.util.Arrays;\r
-import java.util.Iterator;\r
-import java.util.List;\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
-import com.att.nsa.apiClient.credentials.ApiCredential;\r
-import com.att.nsa.apiClient.http.HttpException;\r
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-import com.att.nsa.mr.client.MRClient.MRApiException;\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-import com.att.nsa.mr.client.MRIdentityManager;\r
-import com.att.nsa.mr.client.MRIdentityManager.ApiKey;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ MRClientFactory.class })\r
-public class ApiKeyCommandTest {\r
-\r
- @InjectMocks\r
- private ApiKeyCommand command;\r
- @Mock\r
- private MRIdentityManager tm;\r
- @Mock\r
- private ApiKey ti;\r
- @Mock\r
- private ApiKey key;\r
- @Mock\r
- private ApiCredential ac;\r
- @Mock\r
- private PrintStream printStream;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(MRClientFactory.class);\r
- PowerMockito.when(MRClientFactory.createIdentityManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);\r
- PowerMockito.when(tm.getApiKey("testtopic")).thenReturn(key);\r
- PowerMockito.when(tm.createApiKey("testtopic", "1")).thenReturn(ac);\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(new MRCommandContext());\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() {\r
-\r
- String[] parts1 = { "create", "testtopic", "1" };\r
- String[] parts2 = { "list", "testtopic", "1" };\r
- String[] parts3 = { "revoke", "write", "read" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- }\r
-\r
- @Test\r
- public void testExecute_error1() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {\r
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new IOException("error"));\r
- String[] parts1 = { "create", "testtopic", "1" };\r
- String[] parts2 = { "list", "testtopic", "1" };\r
- String[] parts3 = { "revoke", "write", "read" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error2() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {\r
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new MRApiException("error"));\r
- String[] parts1 = { "create", "testtopic", "1" };\r
- String[] parts2 = { "list", "testtopic", "1" };\r
- String[] parts3 = { "revoke", "write", "read" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(),printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- }\r
-\r
- @Test\r
- public void testExecute_error3() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {\r
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpException(500, "error"));\r
- String[] parts1 = { "create", "testtopic", "1" };\r
- String[] parts2 = { "list", "testtopic", "1" };\r
- String[] parts3 = { "revoke", "write", "read" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error4() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {\r
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));\r
- String[] parts1 = { "create", "testtopic", "1" };\r
- String[] parts2 = { "list", "testtopic", "1" };\r
- String[] parts3 = { "revoke", "write", "read" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
- }\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+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;
+
+import com.att.nsa.apiClient.credentials.ApiCredential;
+import com.att.nsa.apiClient.http.HttpException;
+import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
+import com.att.nsa.cmdtool.CommandNotReadyException;
+import org.onap.dmaap.mr.client.MRClient.MRApiException;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRIdentityManager;
+import org.onap.dmaap.mr.client.MRIdentityManager.ApiKey;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ MRClientFactory.class })
+public class ApiKeyCommandTest {
+
+ @InjectMocks
+ private ApiKeyCommand command;
+ @Mock
+ private MRIdentityManager tm;
+ @Mock
+ private ApiKey ti;
+ @Mock
+ private ApiKey key;
+ @Mock
+ private ApiCredential ac;
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(MRClientFactory.class);
+ PowerMockito.when(MRClientFactory.createIdentityManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);
+ PowerMockito.when(tm.getApiKey("testtopic")).thenReturn(key);
+ PowerMockito.when(tm.createApiKey("testtopic", "1")).thenReturn(ac);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(new MRCommandContext());
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() {
+
+ String[] parts1 = { "create", "testtopic", "1" };
+ String[] parts2 = { "list", "testtopic", "1" };
+ String[] parts3 = { "revoke", "write", "read" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+ }
+
+ @Test
+ public void testExecute_error1() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
+ PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new IOException("error"));
+ String[] parts1 = { "create", "testtopic", "1" };
+ String[] parts2 = { "list", "testtopic", "1" };
+ String[] parts3 = { "revoke", "write", "read" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testExecute_error2() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
+ PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new MRApiException("error"));
+ String[] parts1 = { "create", "testtopic", "1" };
+ String[] parts2 = { "list", "testtopic", "1" };
+ String[] parts3 = { "revoke", "write", "read" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(),printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+ }
+
+ @Test
+ public void testExecute_error3() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
+ PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpException(500, "error"));
+ String[] parts1 = { "create", "testtopic", "1" };
+ String[] parts2 = { "list", "testtopic", "1" };
+ String[] parts3 = { "revoke", "write", "read" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+ }
+
+ }
+
+ @Test
+ public void testExecute_error4() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
+ PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));
+ String[] parts1 = { "create", "testtopic", "1" };
+ String[] parts2 = { "list", "testtopic", "1" };
+ String[] parts3 = { "revoke", "write", "read" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+ }
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+ 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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.PrintStream;\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.modules.junit4.PowerMockRunner;\r
-\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-public class AuthCommandTest {\r
- @InjectMocks\r
- private AuthCommand command = null;\r
- @Mock\r
- private PrintStream printStream;\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 testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(new MRCommandContext());\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() {\r
-\r
- try {\r
- String[] parts = new String[5];\r
- command.execute(parts, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute1() {\r
-\r
- try {\r
- String[] parts = { "userName", "password" };\r
- command.execute(parts, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.PrintStream;
+
+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.modules.junit4.PowerMockRunner;
+
+import com.att.nsa.cmdtool.CommandNotReadyException;
+
+@RunWith(PowerMockRunner.class)
+public class AuthCommandTest {
+ @InjectMocks
+ private AuthCommand command = null;
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(new MRCommandContext());
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() {
+
+ try {
+ String[] parts = new String[5];
+ command.execute(parts, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute1() {
+
+ try {
+ String[] parts = { "userName", "password" };
+ command.execute(parts, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+ 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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.FileNotFoundException;\r
-import java.io.PrintStream;\r
-import java.util.Arrays;\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.modules.junit4.PowerMockRunner;\r
-\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-public class ClusterCommandTest {\r
- @InjectMocks\r
- private ClusterCommand command;\r
- @Mock\r
- private MRCommandContext context;\r
- @Mock\r
- private PrintStream printStream;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.when(context.getCluster()).thenReturn(Arrays.asList("localhost"));\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(context);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() throws FileNotFoundException, CommandNotReadyException {\r
- String[] parts = { "create", "testtopic", "1", "1" };\r
- command.execute(parts, context, printStream);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute1() throws FileNotFoundException, CommandNotReadyException {\r
- String[] parts = {};\r
- command.execute(parts, context, printStream);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.FileNotFoundException;
+import java.io.PrintStream;
+import java.util.Arrays;
+
+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.modules.junit4.PowerMockRunner;
+
+import com.att.nsa.cmdtool.CommandNotReadyException;
+
+@RunWith(PowerMockRunner.class)
+public class ClusterCommandTest {
+ @InjectMocks
+ private ClusterCommand command;
+ @Mock
+ private MRCommandContext context;
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.when(context.getCluster()).thenReturn(Arrays.asList("localhost"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(context);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() throws FileNotFoundException, CommandNotReadyException {
+ String[] parts = { "create", "testtopic", "1", "1" };
+ command.execute(parts, context, printStream);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute1() throws FileNotFoundException, CommandNotReadyException {
+ String[] parts = {};
+ command.execute(parts, context, printStream);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+ 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.mr.tools;\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({ ApiKeyCommandTest.class, AuthCommandTest.class, ClusterCommandTest.class,\r
- MessageCommandTest.class, MRCommandContextTest.class, TopicCommandTest.class, TraceCommandTest.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.tools;
+
+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({ ApiKeyCommandTest.class, AuthCommandTest.class, ClusterCommandTest.class,
+ MessageCommandTest.class, MRCommandContextTest.class, TopicCommandTest.class, TraceCommandTest.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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.io.PrintStream;\r
-import java.util.ArrayList;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.att.nsa.apiClient.http.HttpTracer;\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-import com.att.nsa.mr.client.HostSelector;\r
-import com.att.nsa.mr.client.MRClient;\r
-import com.att.nsa.mr.client.MRPublisher.message;\r
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Entry;\r
-\r
-public class MRCommandContextTest {\r
- private MRCommandContext command = null;\r
- private String[] parts = new String[5];\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- command = new MRCommandContext();\r
-\r
- for (int i = 0; i < parts.length; i++) {\r
- parts[i] = "String" + (i + 1);\r
- }\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testRequestShutdown() {\r
-\r
- command.requestShutdown();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testShouldContinue() {\r
-\r
- command.shouldContinue();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testSetAuth() {\r
-\r
- command.setAuth("key", "pwd");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testClearAuth() {\r
-\r
- command.clearAuth();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckClusterReady() {\r
-\r
- command.checkClusterReady();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetCluster() {\r
-\r
- command.getCluster();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testClearCluster() {\r
-\r
- command.clearCluster();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testAddClusterHost() {\r
-\r
- command.addClusterHost("host");\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetApiKey() {\r
-\r
- command.getApiKey();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testGetApiPwd() {\r
-\r
- command.getApiPwd();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testUseTracer() {\r
-\r
- command.useTracer(null);\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testNoTracer() {\r
-\r
- command.noTracer();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testApplyTracer() {\r
-\r
- command.applyTracer(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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.att.nsa.apiClient.http.HttpTracer;
+import com.att.nsa.cmdtool.CommandNotReadyException;
+import org.onap.dmaap.mr.client.HostSelector;
+import org.onap.dmaap.mr.client.MRClient;
+import org.onap.dmaap.mr.client.MRPublisher.message;
+import org.onap.dmaap.mr.test.support.MRBatchingPublisherMock.Entry;
+
+public class MRCommandContextTest {
+ private MRCommandContext command = null;
+ private String[] parts = new String[5];
+
+ @Before
+ public void setUp() throws Exception {
+ command = new MRCommandContext();
+
+ for (int i = 0; i < parts.length; i++) {
+ parts[i] = "String" + (i + 1);
+ }
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testRequestShutdown() {
+
+ command.requestShutdown();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testShouldContinue() {
+
+ command.shouldContinue();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetAuth() {
+
+ command.setAuth("key", "pwd");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClearAuth() {
+
+ command.clearAuth();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckClusterReady() {
+
+ command.checkClusterReady();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCluster() {
+
+ command.getCluster();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testClearCluster() {
+
+ command.clearCluster();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testAddClusterHost() {
+
+ command.addClusterHost("host");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetApiKey() {
+
+ command.getApiKey();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetApiPwd() {
+
+ command.getApiPwd();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testUseTracer() {
+
+ command.useTracer(null);
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testNoTracer() {
+
+ command.noTracer();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testApplyTracer() {
+
+ command.applyTracer(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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.io.PrintStream;\r
-import java.util.Arrays;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.concurrent.TimeUnit;\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
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-import com.att.nsa.mr.client.MRBatchingPublisher;\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-import com.att.nsa.mr.client.MRConsumer;\r
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ MRClientFactory.class, ToolsUtil.class })\r
-public class MessageCommandTest {\r
- @InjectMocks\r
- private MessageCommand command;\r
- @Mock\r
- private MRConsumer tm;\r
- @Mock\r
- private TopicInfo ti;\r
- @Mock\r
- private MRBatchingPublisher pub;\r
- @Mock\r
- private MRConsumer cc;\r
- @Mock\r
- private PrintStream printStream;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(MRClientFactory.class);\r
- PowerMockito.mockStatic(ToolsUtil.class);\r
- PowerMockito.when(MRClientFactory.createConsumer(Arrays.asList("localhost"), "testtopic", "2", "3", -1, -1,\r
- null, null, null)).thenReturn(cc);\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(new MRCommandContext());\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() {\r
-\r
- String[] parts1 = { "read", "testtopic", "2", "3" };\r
- String[] parts2 = { "write", "testtopic", "2", "3" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- MRCommandContext context = new MRCommandContext();\r
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);\r
- try {\r
- command.execute(part, context, printStream);\r
- } catch (CommandNotReadyException e) {\r
- assertTrue(true);\r
- }\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error1() {\r
- try {\r
- PowerMockito.doThrow(new Exception()).when(cc).fetch();\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
- String[] parts1 = { "read", "testtopic", "2", "3" };\r
- String[] parts2 = { "write", "testtopic", "2", "3" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- MRCommandContext context = new MRCommandContext();\r
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);\r
- try {\r
- command.execute(part, context, printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error2() {\r
- try {\r
- PowerMockito.doThrow(new IOException()).when(pub).close(500, TimeUnit.MILLISECONDS);\r
- PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");\r
-\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } catch (InterruptedException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- String[] parts1 = { "read", "testtopic", "2", "3" };\r
- String[] parts2 = { "write", "testtopic", "2", "3" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- MRCommandContext context = new MRCommandContext();\r
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);\r
- try {\r
- command.execute(part, context, printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- /*\r
- * @Test public void testExecute_error3() {\r
- * \r
- * try { PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");\r
- * PowerMockito.doThrow(new InterruptedException()).when(pub).close(500,\r
- * TimeUnit.MILLISECONDS); } catch (IOException e) { // TODO Auto-generated\r
- * catch block e.printStackTrace(); } catch (InterruptedException e) { //\r
- * TODO Auto-generated catch block e.printStackTrace(); } String[] parts1 =\r
- * { "read", "testtopic", "2", "3" }; String[] parts2 = { "write",\r
- * "testtopic", "2", "3" }; List<String[]> parts = Arrays.asList(parts1,\r
- * parts2); for (Iterator iterator = parts.iterator(); iterator.hasNext();)\r
- * { String[] part = (String[]) iterator.next(); PrintStream printStream =\r
- * new PrintStream(System.out);\r
- * \r
- * MRCommandContext context = new MRCommandContext();\r
- * PowerMockito.when(ToolsUtil.createBatchPublisher(context,\r
- * "testtopic")).thenReturn(pub); try { command.execute(part, context,\r
- * printStream); } catch (CommandNotReadyException e) { // TODO\r
- * Auto-generated catch block e.printStackTrace(); } } assertTrue(true);\r
- * \r
- * }\r
- */\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+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;
+
+import com.att.nsa.cmdtool.CommandNotReadyException;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRConsumer;
+import org.onap.dmaap.mr.client.MRTopicManager.TopicInfo;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ MRClientFactory.class, ToolsUtil.class })
+public class MessageCommandTest {
+ @InjectMocks
+ private MessageCommand command;
+ @Mock
+ private MRConsumer tm;
+ @Mock
+ private TopicInfo ti;
+ @Mock
+ private MRBatchingPublisher pub;
+ @Mock
+ private MRConsumer cc;
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(MRClientFactory.class);
+ PowerMockito.mockStatic(ToolsUtil.class);
+ PowerMockito.when(MRClientFactory.createConsumer(Arrays.asList("localhost"), "testtopic", "2", "3", -1, -1,
+ null, null, null)).thenReturn(cc);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(new MRCommandContext());
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() {
+
+ String[] parts1 = { "read", "testtopic", "2", "3" };
+ String[] parts2 = { "write", "testtopic", "2", "3" };
+ List<String[]> parts = Arrays.asList(parts1, parts2);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ MRCommandContext context = new MRCommandContext();
+ PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
+ try {
+ command.execute(part, context, printStream);
+ } catch (CommandNotReadyException e) {
+ assertTrue(true);
+ }
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute_error1() {
+ try {
+ PowerMockito.doThrow(new Exception()).when(cc).fetch();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ String[] parts1 = { "read", "testtopic", "2", "3" };
+ String[] parts2 = { "write", "testtopic", "2", "3" };
+ List<String[]> parts = Arrays.asList(parts1, parts2);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ MRCommandContext context = new MRCommandContext();
+ PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
+ try {
+ command.execute(part, context, printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute_error2() {
+ try {
+ PowerMockito.doThrow(new IOException()).when(pub).close(500, TimeUnit.MILLISECONDS);
+ PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ String[] parts1 = { "read", "testtopic", "2", "3" };
+ String[] parts2 = { "write", "testtopic", "2", "3" };
+ List<String[]> parts = Arrays.asList(parts1, parts2);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ MRCommandContext context = new MRCommandContext();
+ PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
+ try {
+ command.execute(part, context, printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ assertTrue(true);
+
+ }
+
+ /*
+ * @Test public void testExecute_error3() {
+ *
+ * try { PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");
+ * PowerMockito.doThrow(new InterruptedException()).when(pub).close(500,
+ * TimeUnit.MILLISECONDS); } catch (IOException e) { // TODO Auto-generated
+ * catch block e.printStackTrace(); } catch (InterruptedException e) { //
+ * TODO Auto-generated catch block e.printStackTrace(); } String[] parts1 =
+ * { "read", "testtopic", "2", "3" }; String[] parts2 = { "write",
+ * "testtopic", "2", "3" }; List<String[]> parts = Arrays.asList(parts1,
+ * parts2); for (Iterator iterator = parts.iterator(); iterator.hasNext();)
+ * { String[] part = (String[]) iterator.next(); PrintStream printStream =
+ * new PrintStream(System.out);
+ *
+ * MRCommandContext context = new MRCommandContext();
+ * PowerMockito.when(ToolsUtil.createBatchPublisher(context,
+ * "testtopic")).thenReturn(pub); try { command.execute(part, context,
+ * printStream); } catch (CommandNotReadyException e) { // TODO
+ * Auto-generated catch block e.printStackTrace(); } } assertTrue(true);
+ *
+ * }
+ */
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+
+ }
+
+}
--- /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.tools;
+
+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());
+ }
+
+}
/**
* @author marcin.migdal@nokia.com
*/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
-import com.att.nsa.mr.client.MRBatchingPublisher;
+import org.onap.dmaap.mr.client.MRBatchingPublisher;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
-/*-\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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.IOException;\r
-import java.io.PrintStream;\r
-import java.util.Arrays;\r
-import java.util.Iterator;\r
-import java.util.List;\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
-import com.att.nsa.apiClient.http.HttpException;\r
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-import com.att.nsa.mr.client.MRClientFactory;\r
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;\r
-import com.att.nsa.mr.client.MRTopicManager;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-@PrepareForTest({ MRClientFactory.class })\r
-public class TopicCommandTest {\r
- @InjectMocks\r
- private TopicCommand command;\r
- @Mock\r
- private MRTopicManager tm;\r
- @Mock\r
- private TopicInfo ti;\r
- @Mock\r
- private PrintStream printStream;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
-\r
- MockitoAnnotations.initMocks(this);\r
- PowerMockito.mockStatic(MRClientFactory.class);\r
- PowerMockito.when(MRClientFactory.createTopicManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);\r
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenReturn(ti);\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(new MRCommandContext());\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() {\r
-\r
- String[] parts1 = { "create", "testtopic", "1", "1" };\r
- String[] parts2 = { "grant", "write", "read", "1" };\r
- String[] parts3 = { "revoke", "write", "read", "1" };\r
- String[] parts4 = { "list", "testtopic", "1", "1" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error() {\r
-\r
- String[] parts1 = { "create", "testtopic", "1", "1" };\r
- String[] parts2 = { "grant", "write", "read", "1" };\r
- String[] parts3 = { "revoke", "write", "read", "1" };\r
- String[] parts4 = { "list", "testtopic", "1", "1" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error_1() throws com.att.nsa.apiClient.http.HttpException, IOException {\r
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new IOException("error"));\r
- PowerMockito.doThrow(new IOException()).when(tm).createTopic("testtopic", "", 1, 1);\r
- PowerMockito.doThrow(new IOException()).when(tm).revokeProducer("read", "1");\r
- String[] parts1 = { "create", "testtopic", "1", "1" };\r
- String[] parts2 = { "grant", "read", "read", "1" };\r
- String[] parts3 = { "revoke", "write", "read", "1" };\r
- String[] parts4 = { "list", "testtopic", "1", "1" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error_2() throws com.att.nsa.apiClient.http.HttpException, IOException {\r
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));\r
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);\r
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).revokeConsumer("read", "1");\r
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowConsumer("read", "1");\r
- String[] parts1 = { "create", "testtopic", "1", "1" };\r
- String[] parts2 = { "grant", "write", "write", "1" };\r
- String[] parts3 = { "revoke", "read", "read", "1" };\r
- String[] parts4 = { "list", "testtopic", "1", "1" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute_error_3() throws com.att.nsa.apiClient.http.HttpException, IOException {\r
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);\r
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowProducer("read", "1");\r
- String[] parts1 = { "create", "testtopic", "1a", "1a" };\r
- String[] parts2 = { "grant", "write", "read", "1" };\r
- List<String[]> parts = Arrays.asList(parts1, parts2);\r
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {\r
- String[] part = (String[]) iterator.next();\r
-\r
- try {\r
- command.execute(part, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+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;
+
+import com.att.nsa.apiClient.http.HttpException;
+import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
+import com.att.nsa.cmdtool.CommandNotReadyException;
+import org.onap.dmaap.mr.client.MRClientFactory;
+import org.onap.dmaap.mr.client.MRTopicManager.TopicInfo;
+import org.onap.dmaap.mr.client.MRTopicManager;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ MRClientFactory.class })
+public class TopicCommandTest {
+ @InjectMocks
+ private TopicCommand command;
+ @Mock
+ private MRTopicManager tm;
+ @Mock
+ private TopicInfo ti;
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+
+ MockitoAnnotations.initMocks(this);
+ PowerMockito.mockStatic(MRClientFactory.class);
+ PowerMockito.when(MRClientFactory.createTopicManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);
+ PowerMockito.when(tm.getTopicMetadata("testtopic")).thenReturn(ti);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(new MRCommandContext());
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() {
+
+ String[] parts1 = { "create", "testtopic", "1", "1" };
+ String[] parts2 = { "grant", "write", "read", "1" };
+ String[] parts3 = { "revoke", "write", "read", "1" };
+ String[] parts4 = { "list", "testtopic", "1", "1" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ }
+
+ @Test
+ public void testExecute_error() {
+
+ String[] parts1 = { "create", "testtopic", "1", "1" };
+ String[] parts2 = { "grant", "write", "read", "1" };
+ String[] parts3 = { "revoke", "write", "read", "1" };
+ String[] parts4 = { "list", "testtopic", "1", "1" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ }
+
+ @Test
+ public void testExecute_error_1() throws com.att.nsa.apiClient.http.HttpException, IOException {
+ PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new IOException("error"));
+ PowerMockito.doThrow(new IOException()).when(tm).createTopic("testtopic", "", 1, 1);
+ PowerMockito.doThrow(new IOException()).when(tm).revokeProducer("read", "1");
+ String[] parts1 = { "create", "testtopic", "1", "1" };
+ String[] parts2 = { "grant", "read", "read", "1" };
+ String[] parts3 = { "revoke", "write", "read", "1" };
+ String[] parts4 = { "list", "testtopic", "1", "1" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ }
+
+ @Test
+ public void testExecute_error_2() throws com.att.nsa.apiClient.http.HttpException, IOException {
+ PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));
+ PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);
+ PowerMockito.doThrow(new HttpException(500, "error")).when(tm).revokeConsumer("read", "1");
+ PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowConsumer("read", "1");
+ String[] parts1 = { "create", "testtopic", "1", "1" };
+ String[] parts2 = { "grant", "write", "write", "1" };
+ String[] parts3 = { "revoke", "read", "read", "1" };
+ String[] parts4 = { "list", "testtopic", "1", "1" };
+ List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ }
+
+ @Test
+ public void testExecute_error_3() throws com.att.nsa.apiClient.http.HttpException, IOException {
+ PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);
+ PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowProducer("read", "1");
+ String[] parts1 = { "create", "testtopic", "1a", "1a" };
+ String[] parts2 = { "grant", "write", "read", "1" };
+ List<String[]> parts = Arrays.asList(parts1, parts2);
+ for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
+ String[] part = (String[]) iterator.next();
+
+ try {
+ command.execute(part, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ }
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+ 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.mr.tools;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.io.PrintStream;\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.modules.junit4.PowerMockRunner;\r
-\r
-import com.att.nsa.cmdtool.CommandNotReadyException;\r
-\r
-@RunWith(PowerMockRunner.class)\r
-public class TraceCommandTest {\r
- @InjectMocks\r
- private TraceCommand command;\r
- private String[] parts = new String[5];\r
- @Mock\r
- private PrintStream printStream;\r
-\r
- @Before\r
- public void setUp() throws Exception {\r
- MockitoAnnotations.initMocks(this);\r
- for (int i = 0; i < parts.length; i++) {\r
- parts[i] = "String" + (i + 1);\r
- }\r
-\r
- }\r
-\r
- @After\r
- public void tearDown() throws Exception {\r
-\r
- }\r
-\r
- @Test\r
- public void testGetMatches() {\r
-\r
- command.getMatches();\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testCheckReady() {\r
-\r
- try {\r
- command.checkReady(new MRCommandContext());\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testExecute() {\r
-\r
- try {\r
- command.execute(parts, new MRCommandContext(), printStream);\r
- } catch (CommandNotReadyException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- assertTrue(true);\r
-\r
- }\r
-\r
- @Test\r
- public void testDisplayHelp() {\r
-\r
- command.displayHelp(printStream);\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.tools;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.PrintStream;
+
+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.modules.junit4.PowerMockRunner;
+
+import com.att.nsa.cmdtool.CommandNotReadyException;
+
+@RunWith(PowerMockRunner.class)
+public class TraceCommandTest {
+ @InjectMocks
+ private TraceCommand command;
+ private String[] parts = new String[5];
+ @Mock
+ private PrintStream printStream;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ for (int i = 0; i < parts.length; i++) {
+ parts[i] = "String" + (i + 1);
+ }
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testGetMatches() {
+
+ command.getMatches();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testCheckReady() {
+
+ try {
+ command.checkReady(new MRCommandContext());
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testExecute() {
+
+ try {
+ command.execute(parts, new MRCommandContext(), printStream);
+ } catch (CommandNotReadyException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testDisplayHelp() {
+
+ command.displayHelp(printStream);
+ assertTrue(true);
+
+ }
+
+}
*
*******************************************************************************/
-package com.att.nsa.mr.tools;
+package org.onap.dmaap.mr.tools;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
public class ValidatorUtilTest {
major=1
minor=1
-patch=8
+patch=9
base_version=${major}.${minor}.${patch}