Skip to content

Commit

Permalink
Update copyrights
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Jan 16, 2024
1 parent 844d36b commit 820d9e1
Show file tree
Hide file tree
Showing 41 changed files with 2,008 additions and 1,678 deletions.
2 changes: 1 addition & 1 deletion build-quality.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 EPAM Systems
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 EPAM Systems
* Copyright 2024 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 EPAM Systems
*
* 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.
*/

package com.epam.reportportal.karate;

import com.epam.reportportal.service.ReportPortal;
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/epam/reportportal/karate/ReportPortalHook.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Copyright 2023 EPAM Systems
* Copyright 2024 EPAM Systems
*
* 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
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* 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.
* 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.
*/

package com.epam.reportportal.karate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Copyright 2023 EPAM Systems
* Copyright 2024 EPAM Systems
*
* 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
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
* 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.
* 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.
*/

package com.epam.reportportal.karate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2023 EPAM Systems
* Copyright 2024 EPAM Systems
*
* 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
* 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,
Expand Down
40 changes: 28 additions & 12 deletions src/test/java/com/epam/reportportal/karate/KarateTest.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 EPAM Systems
*
* 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.
*/

package com.epam.reportportal.karate;

import com.intuit.karate.Results;
Expand All @@ -7,16 +23,16 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

class KarateTest {
@Test
void testParallel() {
Results results = KarateReportPortalRunner
.path("classpath:feature")
.outputCucumberJson(true)
.tags("~@ignore", "@To_run")
.parallel(2);
assertEquals(0, results.getFailCount());
assertEquals(0, results.getErrors().size());
assertTrue(results.getSuite().parallel);
assertEquals(2, results.getScenariosTotal());
}
@Test
void testParallel() {
Results results = KarateReportPortalRunner
.path("classpath:feature")
.outputCucumberJson(true)
.tags("~@ignore", "@To_run")
.parallel(2);
assertEquals(0, results.getFailCount());
assertEquals(0, results.getErrors().size());
assertTrue(results.getSuite().parallel);
assertEquals(2, results.getScenariosTotal());
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2024 EPAM Systems
*
* 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.
*/

package com.epam.reportportal.karate;

import com.epam.reportportal.karate.utils.ReflectUtils;
Expand All @@ -24,61 +40,61 @@

@ExtendWith(MockitoExtension.class)
public class ReportPortalPublisherTest {
private ReportPortalPublisher reportPortalPublisher;
@Mock
Launch launchMock;
@Mock
Launch launchMock;
private ReportPortalPublisher reportPortalPublisher;

@BeforeEach
public void setUp() {
reportPortalPublisher = new ReportPortalPublisher(() -> launchMock);
}
@BeforeEach
public void setUp() {
reportPortalPublisher = new ReportPortalPublisher(() -> launchMock);
}

@Test
public void shouldStartLaunch() {
reportPortalPublisher.startLaunch();
verify(launchMock, times(1)).start();
}
@Test
public void shouldStartLaunch() {
reportPortalPublisher.startLaunch();
verify(launchMock, times(1)).start();
}

@Test
public void shouldFinishLaunch() {
when(launchMock.getParameters()).thenReturn(getListenerParameters());
reportPortalPublisher.finishLaunch();
verify(launchMock, times(1)).finish(any(FinishExecutionRQ.class));
}
@Test
public void shouldFinishLaunch() {
when(launchMock.getParameters()).thenReturn(getListenerParameters());
reportPortalPublisher.finishLaunch();
verify(launchMock, times(1)).finish(any(FinishExecutionRQ.class));
}

@SuppressWarnings("unchecked")
@Test
public void shouldStartFeature() throws URISyntaxException {
FeatureResult featureResult = mock(FeatureResult.class);
Feature feature = mock(Feature.class);
Resource resource = mock(Resource.class);
when(featureResult.getFeature()).thenReturn(feature);
when(featureResult.getCallNameForReport()).thenReturn("featureName");
when(feature.getResource()).thenReturn(resource);
when(resource.getUri()).thenReturn(new URI("file:///feature/simple.feature"));
when(launchMock.startTestItem(any(StartTestItemRQ.class))).thenReturn(mock(Maybe.class));
reportPortalPublisher.startFeature(featureResult);
verify(launchMock, times(1)).startTestItem(any(StartTestItemRQ.class));
}
@SuppressWarnings("unchecked")
@Test
public void shouldStartFeature() throws URISyntaxException {
FeatureResult featureResult = mock(FeatureResult.class);
Feature feature = mock(Feature.class);
Resource resource = mock(Resource.class);
when(featureResult.getFeature()).thenReturn(feature);
when(featureResult.getCallNameForReport()).thenReturn("featureName");
when(feature.getResource()).thenReturn(resource);
when(resource.getUri()).thenReturn(new URI("file:///feature/simple.feature"));
when(launchMock.startTestItem(any(StartTestItemRQ.class))).thenReturn(mock(Maybe.class));
reportPortalPublisher.startFeature(featureResult);
verify(launchMock, times(1)).startTestItem(any(StartTestItemRQ.class));
}

@SuppressWarnings("unchecked")
@Test
public void shouldFinishFeature() throws NoSuchFieldException {
FeatureResult featureResult = mock(FeatureResult.class);
when(featureResult.getCallNameForReport()).thenReturn("featureName");
ConcurrentHashMap<String, Maybe<String>> featureIdMap = new ConcurrentHashMap<>();
featureIdMap.put("featureName", mock(Maybe.class));
ReflectUtils.setField(reportPortalPublisher, ReportPortalPublisher.class.getDeclaredField("featureIdMap"), featureIdMap);
reportPortalPublisher.finishFeature(featureResult);
verify(launchMock, times(1)).finishTestItem(any(Maybe.class), any(FinishTestItemRQ.class));
}
@SuppressWarnings("unchecked")
@Test
public void shouldFinishFeature() throws NoSuchFieldException {
FeatureResult featureResult = mock(FeatureResult.class);
when(featureResult.getCallNameForReport()).thenReturn("featureName");
ConcurrentHashMap<String, Maybe<String>> featureIdMap = new ConcurrentHashMap<>();
featureIdMap.put("featureName", mock(Maybe.class));
ReflectUtils.setField(reportPortalPublisher, ReportPortalPublisher.class.getDeclaredField("featureIdMap"), featureIdMap);
reportPortalPublisher.finishFeature(featureResult);
verify(launchMock, times(1)).finishTestItem(any(Maybe.class), any(FinishTestItemRQ.class));
}

private ListenerParameters getListenerParameters() {
ListenerParameters parameters = new ListenerParameters();
parameters.setLaunchName("launch");
parameters.setBaseUrl("url");
parameters.setProjectName("project");
System.setProperty("rp.launch.id", "launchId");
return parameters;
}
private ListenerParameters getListenerParameters() {
ListenerParameters parameters = new ListenerParameters();
parameters.setLaunchName("launch");
parameters.setBaseUrl("url");
parameters.setProjectName("project");
System.setProperty("rp.launch.id", "launchId");
return parameters;
}
}
Loading

0 comments on commit 820d9e1

Please sign in to comment.