Skip to content

Commit

Permalink
deprecation fixes and more
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed Oct 26, 2018
1 parent f9bd99e commit 3ffb6af
Show file tree
Hide file tree
Showing 73 changed files with 1,505 additions and 1,394 deletions.
2 changes: 1 addition & 1 deletion allure-assertj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 17,7 @@ dependencies {
testCompile('org.slf4j:slf4j-simple')
testCompile('org.junit.jupiter:junit-jupiter-api')
testRuntime('org.junit.jupiter:junit-jupiter-engine')
testCompile project(':allure-junit-platform')
testCompile project(':allure-junit5')
testCompile project(':allure-java-commons-test')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 41,16 @@ public Object step(final ProceedingJoinPoint joinPoint) throws Throwable {
: methodSignature.getName();
final String uuid = UUID.randomUUID().toString();
final StepResult result = new StepResult()
.withName(name);
.setName(name);
getLifecycle().startStep(uuid, result);
try {
final Object proceed = joinPoint.proceed();
getLifecycle().updateStep(uuid, s -> s.withStatus(Status.PASSED));
getLifecycle().updateStep(uuid, s -> s.setStatus(Status.PASSED));
return proceed;
} catch (Throwable e) {
getLifecycle().updateStep(uuid, s -> s
.withStatus(getStatus(e).orElse(Status.BROKEN))
.withStatusDetails(getStatusDetails(e).orElse(null)));
.setStatus(getStatus(e).orElse(Status.BROKEN))
.setStatusDetails(getStatusDetails(e).orElse(null)));
throw e;
} finally {
getLifecycle().stopStep(uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 30,7 @@ public void initLifecycle() {
@Test
public void shouldCreateStepsForAsserts() throws Exception {
final String uuid = UUID.randomUUID().toString();
final TestResult result = new TestResult().withUuid(uuid);
final TestResult result = new TestResult().setUuid(uuid);

lifecycle.scheduleTestCase(result);
lifecycle.startTestCase(uuid);
Expand Down
28 changes: 25 additions & 3 deletions allure-attachments/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 4,36 @@ apply from: "${gradleScriptDir}/maven-publish.gradle"
apply from: "${gradleScriptDir}/bintray.gradle"
apply plugin: 'maven'

configurations {
agent
}


dependencies {
agent('org.aspectj:aspectjweaver')

compile project(':allure-java-commons')

compile('org.freemarker:freemarker')

testCompile('junit:junit')
testCompile('org.slf4j:slf4j-simple')
testCompile('org.apache.commons:commons-lang3')
testCompile('org.assertj:assertj-core')
testCompile('org.junit.jupiter:junit-jupiter-api')
testCompile('org.mockito:mockito-core')
testCompile('org.apache.commons:commons-lang3')
testCompile('org.slf4j:slf4j-simple')
testRuntime('org.junit.jupiter:junit-jupiter-engine')
testCompile project(':allure-junit5')
}

test {
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'debug'
systemProperty 'allure.model.indentOutput', true

useJUnitPlatform {
includeEngines 'junit-jupiter'
}

doFirst {
jvmArgs "-javaagent:${configurations.agent.singleFile}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 95,98 @@ public static Builder create(final String attachmentName, final String url) {
return new Builder(attachmentName, url);
}

public Builder withMethod(final String method) {
public Builder setMethod(final String method) {
Objects.requireNonNull(method, "Method must not be null value");
this.method = method;
return this;
}

public Builder withHeader(final String name, final String value) {
public Builder setHeader(final String name, final String value) {
Objects.requireNonNull(name, "Header name must not be null value");
Objects.requireNonNull(value, "Header value must not be null value");
this.headers.put(name, value);
return this;
}

public Builder withHeaders(final Map<String, String> headers) {
public Builder setHeaders(final Map<String, String> headers) {
Objects.requireNonNull(headers, "Headers must not be null value");
this.headers.putAll(headers);
return this;
}

public Builder withCookie(final String name, final String value) {
public Builder setCookie(final String name, final String value) {
Objects.requireNonNull(name, "Cookie name must not be null value");
Objects.requireNonNull(value, "Cookie value must not be null value");
this.cookies.put(name, value);
return this;
}

public Builder withCookies(final Map<String, String> cookies) {
public Builder setCookies(final Map<String, String> cookies) {
Objects.requireNonNull(cookies, "Cookies must not be null value");
this.cookies.putAll(cookies);
return this;
}

public Builder withBody(final String body) {
public Builder setBody(final String body) {
Objects.requireNonNull(body, "Body should not be null value");
this.body = body;
return this;
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withMethod(final String method) {
return setMethod(method);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withHeader(final String name, final String value) {
return setHeader(name, value);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withHeaders(final Map<String, String> headers) {
return setHeaders(headers);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withCookie(final String name, final String value) {
return setCookie(name, value);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withCookies(final Map<String, String> cookies) {
return setCookies(cookies);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withBody(final String body) {
return setBody(body);
}

public HttpRequestAttachment build() {
return new HttpRequestAttachment(name, url, method, body, getCurl(), headers, cookies);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,50 86,113 @@ public static Builder create(final String attachmentName) {
return new Builder(attachmentName);
}

public Builder withUrl(final String url) {
public Builder setUrl(final String url) {
Objects.requireNonNull(url, "Url must not be null value");
this.url = url;
return this;
}

public Builder withResponseCode(final int responseCode) {
public Builder setResponseCode(final int responseCode) {
Objects.requireNonNull(responseCode, "Response code must not be null value");
this.responseCode = responseCode;
return this;
}

public Builder withHeader(final String name, final String value) {
public Builder setHeader(final String name, final String value) {
Objects.requireNonNull(name, "Header name must not be null value");
Objects.requireNonNull(value, "Header value must not be null value");
this.headers.put(name, value);
return this;
}

public Builder withHeaders(final Map<String, String> headers) {
public Builder setHeaders(final Map<String, String> headers) {
Objects.requireNonNull(headers, "Headers must not be null value");
this.headers.putAll(headers);
return this;
}

public Builder withCookie(final String name, final String value) {
public Builder setCookie(final String name, final String value) {
Objects.requireNonNull(name, "Cookie name must not be null value");
Objects.requireNonNull(value, "Cookie value must not be null value");
this.cookies.put(name, value);
return this;
}

public Builder withCookies(final Map<String, String> cookies) {
public Builder setCookies(final Map<String, String> cookies) {
Objects.requireNonNull(cookies, "Cookies must not be null value");
this.cookies.putAll(cookies);
return this;
}

public Builder withBody(final String body) {
public Builder setBody(final String body) {
Objects.requireNonNull(body, "Body should not be null value");
this.body = body;
return this;
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withUrl(final String url) {
return setUrl(url);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withResponseCode(final int responseCode) {
return setResponseCode(responseCode);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withHeader(final String name, final String value) {
return setHeader(name, value);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withHeaders(final Map<String, String> headers) {
return setHeaders(headers);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withCookie(final String name, final String value) {
return setCookie(name, value);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withCookies(final Map<String, String> cookies) {
return setCookies(cookies);
}

/**
* Use setter method instead.
* @deprecated scheduled for removal in 3.0 release
*/
@Deprecated
public Builder withBody(final String body) {
return setBody(body);
}

public HttpResponseAttachment build() {
return new HttpResponseAttachment(name, url, body, responseCode, headers, cookies);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,7 @@

import io.qameta.allure.AllureLifecycle;
import io.qameta.allure.attachment.http.HttpRequestAttachment;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.nio.charset.StandardCharsets;

Expand All @@ -17,11 17,11 @@
/**
* @author charlie (Dmitry Baev).
*/
public class DefaultAttachmentProcessorTest {
class DefaultAttachmentProcessorTest {

@SuppressWarnings("unchecked")
@Test
public void shouldProcessAttachments() throws Exception {
void shouldProcessAttachments() {
final HttpRequestAttachment attachment = randomHttpRequestAttachment();
final AllureLifecycle lifecycle = mock(AllureLifecycle.class);
final AttachmentRenderer<AttachmentData> renderer = mock(AttachmentRenderer.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 1,18 @@
package io.qameta.allure.attachment;

import io.qameta.allure.attachment.http.HttpRequestAttachment;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static io.qameta.allure.attachment.testdata.TestData.randomHttpRequestAttachment;
import static org.assertj.core.api.Assertions.assertThat;

/**
* @author charlie (Dmitry Baev).
*/
public class FreemarkerAttachmentRendererTest {
class FreemarkerAttachmentRendererTest {

@Test
public void shouldRenderRequestAttachment() throws Exception {
public void shouldRenderRequestAttachment() {
final HttpRequestAttachment data = randomHttpRequestAttachment();
final DefaultAttachmentContent content = new FreemarkerAttachmentRenderer("http-request.ftl")
.render(data);
Expand All @@ -24,7 24,7 @@ public void shouldRenderRequestAttachment() throws Exception {
}

@Test
public void shouldRenderResponseAttachment() throws Exception {
public void shouldRenderResponseAttachment() {
final HttpRequestAttachment data = randomHttpRequestAttachment();
final DefaultAttachmentContent content = new FreemarkerAttachmentRenderer("http-response.ftl")
.render(data);
Expand Down
1 change: 1 addition & 0 deletions allure-attachments/src/test/resources/allure.properties
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
allure.results.directory=build/allure-results
Loading

0 comments on commit 3ffb6af

Please sign in to comment.