ak47-core

Ak47 - an easy Network Service Testing Framework

License

License

GroupId

GroupId

com.wangyin
ArtifactId

ArtifactId

ak47-core
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

ak47-core
Ak47 - an easy Network Service Testing Framework
Project Organization

Project Organization

JD-wangyin

Download ak47-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.wangyin/ak47-core/ -->
<dependency>
    <groupId>com.wangyin</groupId>
    <artifactId>ak47-core</artifactId>
    <version>0.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.wangyin/ak47-core/
implementation 'com.wangyin:ak47-core:0.1.2'
// https://jarcasting.com/artifacts/com.wangyin/ak47-core/
implementation ("com.wangyin:ak47-core:0.1.2")
'com.wangyin:ak47-core:jar:0.1.2'
<dependency org="com.wangyin" name="ak47-core" rev="0.1.2">
  <artifact name="ak47-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.wangyin', module='ak47-core', version='0.1.2')
)
libraryDependencies += "com.wangyin" % "ak47-core" % "0.1.2"
[com.wangyin/ak47-core "0.1.2"]

Dependencies

compile (5)

Group / Artifact Type Version
io.netty : netty-all jar 4.0.29.Final
org.slf4j : slf4j-api jar 1.7.5
ch.qos.logback : logback-classic jar 1.0.13
ch.qos.logback : logback-core jar 1.0.13
org.yaml : snakeyaml jar 1.12

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.8.7

Project Modules

There are no modules declared in this project.

Ak47

Ak47 is an easy Network Service Testing Framework. It is a Test-Specific Framework, designed for better Automation-Testing, Performance-Testing, Mock-Testing and with the same code style.

Ak47 can support almost all network protocols, such as HTTP, Hession, ISO8583, Dubbo, Thrift, and other RPC protocols, only if there is a corresponding Pipe.

Ak47 is base on Netty/NIO, and its design philosophy is simple to use, scalable, and high performance.

Examples

A Simple Http Driver

// new a Pipe
SimpleHttpPipe pipe = new SimpleHttpPipe();

// create a simple driver
SimpleDriver<SimpleHttpRequest, SimpleHttpResponse> driver = 
        pipe.createSimpleDriver("www.jd.com", 80);

// prepare a request
SimpleHttpRequest httpreq = new SimpleHttpRequest("GET", "/");

// send it, and get a response
SimpleHttpResponse httpres = driver.send(httpreq);

// finally check the res.
System.out.println(httpres.getStatusCode());
System.out.println(httpres.getContent().length);

A Simple Http Stub

// new a Pipe
SimpleHttpPipe pipe = new SimpleHttpPipe();

// create a stub
SimpleStub<SimpleHttpRequest, SimpleHttpResponse> stub = pipe.createSimpleStub(8055);

// add a service
stub.addService("myservice", new Service<SimpleHttpRequest, SimpleHttpResponse>(){
    @Override
    public void doService(Request<SimpleHttpRequest> request,
            Response<SimpleHttpResponse> response) throws Exception {
        SimpleHttpRequest httpreq = request.pojo();
        
        SimpleHttpResponse httpres = new SimpleHttpResponse();
        String content = "Hello Ak47! Your request url is "+httpreq.getUrl();
        httpres.setContent(content.getBytes());
        response.pojo(httpres);
    }
});

// finally start and hold it.
stub.start();
stub.hold();

How to build

You require the following to build AK47:

Note that this is build-time requirement. JDK 6 is enough to run your AK47-based application.

Contributing

Ak47 is free software/open source, and is distributed under the Apache License 2.0.

Please feel free to contribute code or documentation. Welcome to Pull Requests.

Here is the code contributors so fa: hannyu, xwliang, nabokil.

Questions?

You can try creating an issue, or searching issues, or email to hannyu.

WIKI

Welcome to the AK47 wiki. Please head to [User Guide].

欢迎来到Ak47主页,请转到[用户指南]

com.wangyin

京东网银

JD&Wangyin

Versions

Version
0.1.2
0.1.1
0.1.0