forked from shazam/fork
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrade gradle and android plugin * use implementation and api instead of compile * migrate chimprunner and fork-reporter * remove old implementation * add includedAnnotation to config and gradle plugin task * add includedAnnotation and excludedAnnotation to TestSuiteLoader * implement convert from com.example.Test to Lcom/example/Test; * implement exclude/include on TestSuiteLoader level * fix compilation error * add common pool strategy * implement exclude/include annotations at TestSuiteLoader * remove logger * refactoring of TestSuiteLoader. add tests for parseAnnotation function * fix TestSuiteLoader bug * fix TestSuiteLoader * [WIP] Execution chart + Sorting (#13) * add teamcity client * add fork sorting common module. add basic entities * add fork-sorting-teamcity module. this module incapsulate teamcity client and mapping * add Teamcity based sorting strategy * add dependencies between modules * add chart page * move history manager and testexecution reporter to stat package * return optional from test history manager * fix summary printer injector * cleanup properties * use long timestamp instead of string format * use timestamp instead of string * change format of report * rework loader * rename package * rework teamcity loader * remove test.yaml * temp solution * fix compile time errors * add testMetrics getter * remove dependency to fork-stat-teamcity from fork-runner * move teamcity client to fork-stat-teamcity * add queue provider * use TestCaseEventFactory instead of static factory methods * remove testHistoryManager * remove unused AuthConfig * removed unused function * fix chart * add info about idling * remove logs * fix comments * change tick format * experiment with PriorityBlockingQueue * fix codeformat * alpha1 release
- Loading branch information
Showing
102 changed files
with
2,492 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ner/src/main/java/com/shazam/chimprunner/injector/model/TestCaseEventFactoryInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.shazam.chimprunner.injector.model; | ||
|
||
import com.shazam.fork.model.TestCaseEventFactory; | ||
|
||
import static com.shazam.chimprunner.injector.stat.TestStatLoaderInjector.testStatsLoader; | ||
|
||
public class TestCaseEventFactoryInjector { | ||
public static TestCaseEventFactory testCaseEventFactory(){ | ||
return new TestCaseEventFactory(testStatsLoader()); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...prunner/src/main/java/com/shazam/chimprunner/injector/stat/StatServiceLoaderInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.shazam.chimprunner.injector.stat; | ||
|
||
import com.shazam.fork.stat.StatServiceLoader; | ||
|
||
public class StatServiceLoaderInjector { | ||
|
||
private static StatServiceLoader INSTANCE = null; | ||
|
||
public static synchronized StatServiceLoader statServiceLoader() { | ||
if (INSTANCE == null) { | ||
INSTANCE = new StatServiceLoader(""); | ||
} | ||
return INSTANCE; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
chimprunner/src/main/java/com/shazam/chimprunner/injector/stat/TestStatLoaderInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.shazam.chimprunner.injector.stat; | ||
|
||
import com.shazam.fork.stat.TestStatsLoader; | ||
|
||
import static com.shazam.chimprunner.injector.stat.StatServiceLoaderInjector.statServiceLoader; | ||
|
||
public class TestStatLoaderInjector { | ||
private static final TestStatsLoader INSTANCE = new TestStatsLoader(statServiceLoader()); | ||
|
||
public static TestStatsLoader testStatsLoader() { | ||
return INSTANCE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ommon-test-dex/app/src/androidTest/java/com/shazam/annotations/CustomTestAnnotation1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.shazam.annotations; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD}) | ||
public @interface CustomTestAnnotation1 { | ||
} |
13 changes: 13 additions & 0 deletions
13
...ommon-test-dex/app/src/androidTest/java/com/shazam/annotations/CustomTestAnnotation2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.shazam.annotations; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@Retention(RUNTIME) | ||
@Target({TYPE, METHOD}) | ||
public @interface CustomTestAnnotation2 { | ||
} |
17 changes: 17 additions & 0 deletions
17
...test-dex/app/src/androidTest/java/com/shazam/forktest/CustomTestAnnotation1ClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.shazam.forktest; | ||
|
||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import com.shazam.annotations.CustomTestAnnotation1; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@CustomTestAnnotation1 | ||
public class CustomTestAnnotation1ClassTest { | ||
|
||
@Test | ||
public void methodOfAnCustomTestAnnotation1TestClass() { | ||
assertEquals(4, 2 + 2); | ||
} | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
...test-dex/app/src/androidTest/java/com/shazam/forktest/CustomTestAnnotation2ClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.shazam.forktest; | ||
|
||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import com.shazam.annotations.CustomTestAnnotation2; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@CustomTestAnnotation2 | ||
public class CustomTestAnnotation2ClassTest { | ||
|
||
@Test | ||
public void methodOfAnCustomTestAnnotation2TestClass() { | ||
assertEquals(4, 2 + 2); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
fork-common/src/main/java/com/shazam/fork/model/TestCaseEventFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.shazam.fork.model; | ||
|
||
import com.android.ddmlib.testrunner.TestIdentifier; | ||
import com.shazam.fork.stat.TestStatsLoader; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class TestCaseEventFactory { | ||
|
||
private final TestStatsLoader statsLoader; | ||
|
||
public TestCaseEventFactory(TestStatsLoader statsLoader) { | ||
this.statsLoader = statsLoader; | ||
} | ||
|
||
public TestCaseEvent newTestCase(@Nonnull TestIdentifier testIdentifier) { | ||
return new TestCaseEvent(testIdentifier.getTestName(), | ||
testIdentifier.getClassName(), | ||
false, | ||
Collections.emptyList(), | ||
Collections.emptyMap(), | ||
statsLoader.findMetric(testIdentifier.getClassName(), testIdentifier.getClassName())); | ||
} | ||
|
||
public TestCaseEvent newTestCase(String testMethod, String testClass, boolean isIgnored, List<String> permissionsToRevoke, Map<String, String> properties) { | ||
return new TestCaseEvent(testMethod, testClass, isIgnored, permissionsToRevoke, properties, statsLoader.findMetric(testClass, testMethod)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
fork-common/src/main/java/com/shazam/fork/stat/StatServiceLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.shazam.fork.stat; | ||
|
||
import com.agoda.fork.stat.StatLoader; | ||
import com.agoda.fork.stat.StatLoaderProvider; | ||
import com.agoda.fork.stat.TestHistory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.ServiceLoader; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.StreamSupport; | ||
|
||
public class StatServiceLoader { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(StatServiceLoader.class); | ||
|
||
private final String path; | ||
|
||
public StatServiceLoader(String path) { | ||
this.path = path; | ||
} | ||
|
||
public List<TestHistory> load() { | ||
return StreamSupport.stream(ServiceLoader.load(StatLoaderProvider.class).spliterator(), true) | ||
.flatMap(loader -> { | ||
List<TestHistory> histories = new ArrayList<>(); | ||
try { | ||
histories.addAll(loader.create(path).loadHistory()); | ||
} catch (FileNotFoundException e) { | ||
logger.error("can't load history", e); | ||
} | ||
return histories.stream(); | ||
}) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
Oops, something went wrong.