Skip to content

Quick Start Guide

Dmytro Mykhaliev edited this page Aug 13, 2019 · 4 revisions

CA CodeSV is available on Maven repository or for installation from GitHub. You can clone the example project or download the product directly from the CodeSV GitHub page.

1. Configure Your Project

Choose from one of the setup options below to configure CodeSV:

Maven Setup

To add the CodeSV product dependency to your Maven project follow these steps:

  1. Modify your pom.xml by adding the CA repository:
<repositories>
  <!-- your other repositories -->
  <repository>
    <id>bintray-ca-sv</id>
    <name>bintray-ca</name>
    <url>http://ca.bintray.com/sv</url>
  </repository>
</repositories>
  1. Add the CodeSV product dependency:
<dependency>
  <groupId>com.broadcom.codesv</groupId>
  <artifactId>codesv-dist-jar</artifactId>
  <version>2.0.0</version>
</dependency>

Gradle Setup

To add CodeSV product dependency to your Gradle project follow these steps:

  1. Modify your build.gradle by adding the CA repository:
repositories {
  maven {
    url "http://ca.bintray.com/sv"
  }
}
  1. Add the CodeSV product dependency:
dependencies {
  compile 'com.broadcom.codesv:codesv-dist-jar:2.0.0'
}

2. Ready To Go

The example below will allow you to run a jUnit test running an embedded virtual service using CodeSV.

  1. Add the following imports to your jUnit test class:

    import static com.ca.codesv.protocols.http.fluent.HttpFluentInterface.*; 
    import com.ca.codesv.engine.junit4.VirtualServerRule;
    
  2. Create a jUnit Rule and a test method with the specification of a new virtualized service.

@Rule
public VirtualServerRule vs = new VirtualServerRule();

@Test
public void testBasicExample() throws IOException {
   forGet("http://customUrl:8542/test/url").doReturn(
       okMessage()
           .withStringBody("Success")
   );
}

More Information:

For more code examples, see Code Library

For API documentation, see Javadoc

For more information, to share ideas, or to raise issues, see the CA Service Virtualization/DevTest community page at the following URL: https://communities.ca.com/community/ca-devtest-community

Clone this wiki locally