Skip to content

Commit e145f82

Browse files
vbraginbaev
authored andcommitted
add support for java 9+ (fixes 208, via #249)
1 parent 21864ae commit e145f82

File tree

142 files changed

+4362
-778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+4362
-778
lines changed

allure-assertj/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ dependencies {
2121
testCompile project(':allure-java-commons-test')
2222
}
2323

24+
jar {
25+
manifest {
26+
attributes(
27+
'Automatic-Module-Name': 'io.qameta.allure.assertj'
28+
)
29+
}
30+
}
31+
2432
test {
2533
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'debug'
2634
systemProperty 'allure.model.indentOutput', true

allure-assertj/src/main/java/io/qameta/allure/assertj/AllureAspectJ.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ public Object step(final ProceedingJoinPoint joinPoint) throws Throwable {
4141
: methodSignature.getName();
4242
final String uuid = UUID.randomUUID().toString();
4343
final StepResult result = new StepResult()
44-
.withName(name);
44+
.setName(name);
4545
getLifecycle().startStep(uuid, result);
4646
try {
4747
final Object proceed = joinPoint.proceed();
48-
getLifecycle().updateStep(uuid, s -> s.withStatus(Status.PASSED));
48+
getLifecycle().updateStep(uuid, s -> s.setStatus(Status.PASSED));
4949
return proceed;
5050
} catch (Throwable e) {
5151
getLifecycle().updateStep(uuid, s -> s
52-
.withStatus(getStatus(e).orElse(Status.BROKEN))
53-
.withStatusDetails(getStatusDetails(e).orElse(null)));
52+
.setStatus(getStatus(e).orElse(Status.BROKEN))
53+
.setStatusDetails(getStatusDetails(e).orElse(null)));
5454
throw e;
5555
} finally {
5656
getLifecycle().stopStep(uuid);

allure-assertj/src/test/java/io/qameta/allure/assertj/AllureAspectJTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void initLifecycle() {
3030
@Test
3131
public void shouldCreateStepsForAsserts() throws Exception {
3232
final String uuid = UUID.randomUUID().toString();
33-
final TestResult result = new TestResult().withUuid(uuid);
33+
final TestResult result = new TestResult().setUuid(uuid);
3434

3535
lifecycle.scheduleTestCase(result);
3636
lifecycle.startTestCase(uuid);

allure-attachments/build.gradle

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,43 @@ apply from: "${gradleScriptDir}/maven-publish.gradle"
44
apply from: "${gradleScriptDir}/bintray.gradle"
55
apply plugin: 'maven'
66

7+
configurations {
8+
agent
9+
}
10+
711
dependencies {
12+
agent('org.aspectj:aspectjweaver')
13+
814
compile project(':allure-java-commons')
915

1016
compile('org.freemarker:freemarker')
1117

12-
testCompile('junit:junit')
13-
testCompile('org.slf4j:slf4j-simple')
18+
testCompile('org.apache.commons:commons-lang3')
1419
testCompile('org.assertj:assertj-core')
20+
testCompile('org.junit.jupiter:junit-jupiter-api')
1521
testCompile('org.mockito:mockito-core')
16-
testCompile('org.apache.commons:commons-lang3')
22+
testCompile('org.slf4j:slf4j-simple')
23+
testRuntime('org.junit.jupiter:junit-jupiter-engine')
24+
testCompile project(':allure-junit-platform')
25+
}
26+
27+
jar {
28+
manifest {
29+
attributes(
30+
'Automatic-Module-Name': 'io.qameta.allure.attachment'
31+
)
32+
}
1733
}
34+
35+
test {
36+
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'debug'
37+
systemProperty 'allure.model.indentOutput', true
38+
39+
useJUnitPlatform {
40+
includeEngines 'junit-jupiter'
41+
}
42+
43+
doFirst {
44+
jvmArgs "-javaagent:${configurations.agent.singleFile}"
45+
}
46+
}

allure-attachments/src/main/java/io/qameta/allure/attachment/http/HttpRequestAttachment.java

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,44 +95,98 @@ public static Builder create(final String attachmentName, final String url) {
9595
return new Builder(attachmentName, url);
9696
}
9797

98-
public Builder withMethod(final String method) {
98+
public Builder setMethod(final String method) {
9999
Objects.requireNonNull(method, "Method must not be null value");
100100
this.method = method;
101101
return this;
102102
}
103103

104-
public Builder withHeader(final String name, final String value) {
104+
public Builder setHeader(final String name, final String value) {
105105
Objects.requireNonNull(name, "Header name must not be null value");
106106
Objects.requireNonNull(value, "Header value must not be null value");
107107
this.headers.put(name, value);
108108
return this;
109109
}
110110

111-
public Builder withHeaders(final Map<String, String> headers) {
111+
public Builder setHeaders(final Map<String, String> headers) {
112112
Objects.requireNonNull(headers, "Headers must not be null value");
113113
this.headers.putAll(headers);
114114
return this;
115115
}
116116

117-
public Builder withCookie(final String name, final String value) {
117+
public Builder setCookie(final String name, final String value) {
118118
Objects.requireNonNull(name, "Cookie name must not be null value");
119119
Objects.requireNonNull(value, "Cookie value must not be null value");
120120
this.cookies.put(name, value);
121121
return this;
122122
}
123123

124-
public Builder withCookies(final Map<String, String> cookies) {
124+
public Builder setCookies(final Map<String, String> cookies) {
125125
Objects.requireNonNull(cookies, "Cookies must not be null value");
126126
this.cookies.putAll(cookies);
127127
return this;
128128
}
129129

130-
public Builder withBody(final String body) {
130+
public Builder setBody(final String body) {
131131
Objects.requireNonNull(body, "Body should not be null value");
132132
this.body = body;
133133
return this;
134134
}
135135

136+
/**
137+
* Use setter method instead.
138+
* @deprecated scheduled for removal in 3.0 release
139+
*/
140+
@Deprecated
141+
public Builder withMethod(final String method) {
142+
return setMethod(method);
143+
}
144+
145+
/**
146+
* Use setter method instead.
147+
* @deprecated scheduled for removal in 3.0 release
148+
*/
149+
@Deprecated
150+
public Builder withHeader(final String name, final String value) {
151+
return setHeader(name, value);
152+
}
153+
154+
/**
155+
* Use setter method instead.
156+
* @deprecated scheduled for removal in 3.0 release
157+
*/
158+
@Deprecated
159+
public Builder withHeaders(final Map<String, String> headers) {
160+
return setHeaders(headers);
161+
}
162+
163+
/**
164+
* Use setter method instead.
165+
* @deprecated scheduled for removal in 3.0 release
166+
*/
167+
@Deprecated
168+
public Builder withCookie(final String name, final String value) {
169+
return setCookie(name, value);
170+
}
171+
172+
/**
173+
* Use setter method instead.
174+
* @deprecated scheduled for removal in 3.0 release
175+
*/
176+
@Deprecated
177+
public Builder withCookies(final Map<String, String> cookies) {
178+
return setCookies(cookies);
179+
}
180+
181+
/**
182+
* Use setter method instead.
183+
* @deprecated scheduled for removal in 3.0 release
184+
*/
185+
@Deprecated
186+
public Builder withBody(final String body) {
187+
return setBody(body);
188+
}
189+
136190
public HttpRequestAttachment build() {
137191
return new HttpRequestAttachment(name, url, method, body, getCurl(), headers, cookies);
138192
}

allure-attachments/src/main/java/io/qameta/allure/attachment/http/HttpResponseAttachment.java

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,50 +86,113 @@ public static Builder create(final String attachmentName) {
8686
return new Builder(attachmentName);
8787
}
8888

89-
public Builder withUrl(final String url) {
89+
public Builder setUrl(final String url) {
9090
Objects.requireNonNull(url, "Url must not be null value");
9191
this.url = url;
9292
return this;
9393
}
9494

95-
public Builder withResponseCode(final int responseCode) {
95+
public Builder setResponseCode(final int responseCode) {
9696
Objects.requireNonNull(responseCode, "Response code must not be null value");
9797
this.responseCode = responseCode;
9898
return this;
9999
}
100100

101-
public Builder withHeader(final String name, final String value) {
101+
public Builder setHeader(final String name, final String value) {
102102
Objects.requireNonNull(name, "Header name must not be null value");
103103
Objects.requireNonNull(value, "Header value must not be null value");
104104
this.headers.put(name, value);
105105
return this;
106106
}
107107

108-
public Builder withHeaders(final Map<String, String> headers) {
108+
public Builder setHeaders(final Map<String, String> headers) {
109109
Objects.requireNonNull(headers, "Headers must not be null value");
110110
this.headers.putAll(headers);
111111
return this;
112112
}
113113

114-
public Builder withCookie(final String name, final String value) {
114+
public Builder setCookie(final String name, final String value) {
115115
Objects.requireNonNull(name, "Cookie name must not be null value");
116116
Objects.requireNonNull(value, "Cookie value must not be null value");
117117
this.cookies.put(name, value);
118118
return this;
119119
}
120120

121-
public Builder withCookies(final Map<String, String> cookies) {
121+
public Builder setCookies(final Map<String, String> cookies) {
122122
Objects.requireNonNull(cookies, "Cookies must not be null value");
123123
this.cookies.putAll(cookies);
124124
return this;
125125
}
126126

127-
public Builder withBody(final String body) {
127+
public Builder setBody(final String body) {
128128
Objects.requireNonNull(body, "Body should not be null value");
129129
this.body = body;
130130
return this;
131131
}
132132

133+
/**
134+
* Use setter method instead.
135+
* @deprecated scheduled for removal in 3.0 release
136+
*/
137+
@Deprecated
138+
public Builder withUrl(final String url) {
139+
return setUrl(url);
140+
}
141+
142+
/**
143+
* Use setter method instead.
144+
* @deprecated scheduled for removal in 3.0 release
145+
*/
146+
@Deprecated
147+
public Builder withResponseCode(final int responseCode) {
148+
return setResponseCode(responseCode);
149+
}
150+
151+
/**
152+
* Use setter method instead.
153+
* @deprecated scheduled for removal in 3.0 release
154+
*/
155+
@Deprecated
156+
public Builder withHeader(final String name, final String value) {
157+
return setHeader(name, value);
158+
}
159+
160+
/**
161+
* Use setter method instead.
162+
* @deprecated scheduled for removal in 3.0 release
163+
*/
164+
@Deprecated
165+
public Builder withHeaders(final Map<String, String> headers) {
166+
return setHeaders(headers);
167+
}
168+
169+
/**
170+
* Use setter method instead.
171+
* @deprecated scheduled for removal in 3.0 release
172+
*/
173+
@Deprecated
174+
public Builder withCookie(final String name, final String value) {
175+
return setCookie(name, value);
176+
}
177+
178+
/**
179+
* Use setter method instead.
180+
* @deprecated scheduled for removal in 3.0 release
181+
*/
182+
@Deprecated
183+
public Builder withCookies(final Map<String, String> cookies) {
184+
return setCookies(cookies);
185+
}
186+
187+
/**
188+
* Use setter method instead.
189+
* @deprecated scheduled for removal in 3.0 release
190+
*/
191+
@Deprecated
192+
public Builder withBody(final String body) {
193+
return setBody(body);
194+
}
195+
133196
public HttpResponseAttachment build() {
134197
return new HttpResponseAttachment(name, url, body, responseCode, headers, cookies);
135198
}

allure-attachments/src/test/java/io/qameta/allure/attachment/DefaultAttachmentProcessorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import io.qameta.allure.AllureLifecycle;
44
import io.qameta.allure.attachment.http.HttpRequestAttachment;
5-
import org.junit.Test;
5+
import org.junit.jupiter.api.Test;
66

77
import java.nio.charset.StandardCharsets;
88

@@ -17,11 +17,11 @@
1717
/**
1818
* @author charlie (Dmitry Baev).
1919
*/
20-
public class DefaultAttachmentProcessorTest {
20+
class DefaultAttachmentProcessorTest {
2121

2222
@SuppressWarnings("unchecked")
2323
@Test
24-
public void shouldProcessAttachments() throws Exception {
24+
void shouldProcessAttachments() {
2525
final HttpRequestAttachment attachment = randomHttpRequestAttachment();
2626
final AllureLifecycle lifecycle = mock(AllureLifecycle.class);
2727
final AttachmentRenderer<AttachmentData> renderer = mock(AttachmentRenderer.class);

allure-attachments/src/test/java/io/qameta/allure/attachment/FreemarkerAttachmentRendererTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package io.qameta.allure.attachment;
22

33
import io.qameta.allure.attachment.http.HttpRequestAttachment;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

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

99
/**
1010
* @author charlie (Dmitry Baev).
1111
*/
12-
public class FreemarkerAttachmentRendererTest {
12+
class FreemarkerAttachmentRendererTest {
1313

1414
@Test
15-
public void shouldRenderRequestAttachment() throws Exception {
15+
public void shouldRenderRequestAttachment() {
1616
final HttpRequestAttachment data = randomHttpRequestAttachment();
1717
final DefaultAttachmentContent content = new FreemarkerAttachmentRenderer("http-request.ftl")
1818
.render(data);
@@ -24,7 +24,7 @@ public void shouldRenderRequestAttachment() throws Exception {
2424
}
2525

2626
@Test
27-
public void shouldRenderResponseAttachment() throws Exception {
27+
public void shouldRenderResponseAttachment() {
2828
final HttpRequestAttachment data = randomHttpRequestAttachment();
2929
final DefaultAttachmentContent content = new FreemarkerAttachmentRenderer("http-response.ftl")
3030
.render(data);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allure.results.directory=build/allure-results

allure-cucumber-jvm/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ dependencies {
2020
testCompile('junit:junit:4.12')
2121
}
2222

23+
jar {
24+
manifest {
25+
attributes(
26+
'Automatic-Module-Name': 'io.qameta.allure.cucumberjvm'
27+
)
28+
}
29+
}
30+
2331
test.doFirst {
2432
jvmArgs "-javaagent:${configurations.agent.singleFile}"
2533
}

0 commit comments

Comments
 (0)