Skip to content

Commit

Permalink
Completed validation of multi-line composite statements
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Nov 2, 2024
1 parent 8d6d0f9 commit d6e4511
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 80 deletions.
9 changes: 0 additions & 9 deletions src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ public void testBlameWithLocalRepoUsingFileTracker(String url, String filePath,
assertEqualWithFile(expectedFilePath, actual);
}

@Test
public void testBlameWithLocalRepo() throws Exception {
String url = "https://github.com/pouryafard75/DiffBenchmark/commit/5b33dc6f8cfcf8c0e31966c035b0406eca97ec76";
String filePath = "src/main/java/dat/MakeIntels.java";
String expectedFilePath = System.getProperty("user.dir") + "/src/test/resources/blame/blameTestWithLocalRepo2.txt";
String actual = getBlameOutput(url, filePath, new CodeTrackerBlame(), REPOS_PATH, gitService);
assertEqualWithFile(expectedFilePath, actual);
}

@Test
public void blameTestAttributeAnnotation() throws Exception {
String url = "https://github.com/eclipse/jgit/commit/bd1a82502680b5de5bf86f6c4470185fd1602386";
Expand Down
42 changes: 21 additions & 21 deletions src/test/resources/blame/blameTestUntilCommitZero.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/test/resources/blame/blameTestWithLocalRepo16.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ ea63463c2 src/main/java/libcore/net/spdy/SpdyConnection.java
60b3a6dd6 src/main/java/libcore/net/spdy/SpdyConnection.java (Jesse Wilson 2012-09-25 18:29:25 +0000 256) }
fb46f100a okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/SpdyConnection.java (Adrian Cole 2014-02-24 01:16:01 +0000 257) if (associatedStreamId == 0) {
3d43a8dba okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java (jwilson 2016-07-09 22:09:19 +0000 258) writer.synStream(outFinished, streamId, associatedStreamId, requestHeaders);
a5ba3e906 okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyConnection.java (Adrian Cole 2014-03-02 05:23:04 +0000 259) } else if (client) {
1ab398fb9 okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyConnection.java (Adrian Cole 2014-03-05 04:53:13 +0000 259) } else if (client) {
1ab398fb9 okhttp/src/main/java/com/squareup/okhttp/internal/spdy/SpdyConnection.java (Adrian Cole 2014-03-05 04:53:13 +0000 260) throw new IllegalArgumentException("client streams shouldn't have associated stream IDs");
fb46f100a okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/SpdyConnection.java (Adrian Cole 2014-02-24 01:16:01 +0000 261) } else { // HTTP/2 has a PUSH_PROMISE frame.
3d43a8dba okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java (jwilson 2016-07-09 22:09:19 +0000 262) writer.pushPromise(associatedStreamId, streamId, requestHeaders);
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/blame/blameTestWithLocalRepo17.txt
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ dbecbe5df hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-res
498)
dbecbe5df hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Vinod Kumar Vavilapalli 2011-08-18 11:07:10 +0000 499) // Try to assign containers to applications in fifo order
de3b4aac5 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Jian He 2016-11-07 18:14:39 +0000 500) for (Map.Entry<ApplicationId, SchedulerApplication<FifoAppAttempt>> e : applications
de3b4aac5 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Jian He 2016-11-07 18:14:39 +0000 501) .entrySet()) {
dbecbe5df hadoop-mapreduce/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Vinod Kumar Vavilapalli 2011-08-18 11:07:10 +0000 501) .entrySet()) {
de3b4aac5 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Jian He 2016-11-07 18:14:39 +0000 502) FifoAppAttempt application = e.getValue().getCurrentAppAttempt();
84dfae2f8 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Sanford Ryza 2014-05-14 06:41:20 +0000 503) if (application == null) {
84dfae2f8 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java (Sanford Ryza 2014-05-14 06:41:20 +0000 504) continue;
Expand Down
16 changes: 8 additions & 8 deletions src/test/resources/blame/blameTestWithLocalRepo20.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ c285d6f8b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
448100ff8 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-06 10:02:01 +0000 94) int status = info.getStatus();
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 95) boolean interimResponse = status == HttpStatus.CONTINUE_100 || status == HttpStatus.PROCESSING_102;
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 96) if (interimResponse)
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 97) {
c285d6f8b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2017-04-03 20:25:50 +0000 97) {
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 98) // Must not commit interim responses.
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 99) if (hasContent)
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 100) {
Expand All @@ -109,9 +109,9 @@ c1247ff67 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
c285d6f8b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2017-04-03 20:25:50 +0000 109) else
c1247ff67 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-06-09 12:01:16 +0000 110) {
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 111) if (commit.compareAndSet(false, true))
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 112) {
ad034f4d5 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-06-10 10:02:54 +0000 112) {
418a49333 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-18 09:50:18 +0000 113) if (hasContent)
418a49333 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-18 09:50:18 +0000 114) {
3e602117b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-17 16:07:22 +0000 114) {
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 115) Callback commitCallback = new Callback.Nested(callback)
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 116) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 117) @Override
Expand Down Expand Up @@ -157,7 +157,7 @@ c1247ff67 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
3e602117b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-17 16:07:22 +0000 157) else
c1247ff67 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-06-09 12:01:16 +0000 158) {
418a49333 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-18 09:50:18 +0000 159) if (hasContent || lastContent)
418a49333 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-09-18 09:50:18 +0000 160) {
ad034f4d5 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2014-06-10 10:02:54 +0000 160) {
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 161) if (lastContent)
06454f640 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2018-04-07 10:25:39 +0000 162) {
c285d6f8b jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2017-04-03 20:25:50 +0000 163) Supplier<HttpFields> trailers = metaData.getTrailerSupplier();
Expand Down Expand Up @@ -275,11 +275,11 @@ e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
02b573272 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2015-02-09 08:11:56 +0000 275) // If the stream is not closed, it is still reading the request content.
02b573272 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2015-02-09 08:11:56 +0000 276) // Send a reset to the other end so that it stops sending data.
02b573272 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2015-02-09 08:11:56 +0000 277) if (!stream.isClosed())
02b573272 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2015-02-09 08:11:56 +0000 278) {
cf0ecbd88 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-07-21 15:50:08 +0000 278) {
cf0ecbd88 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-07-21 15:50:08 +0000 279) if (LOG.isDebugEnabled())
cf0ecbd88 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-07-21 15:50:08 +0000 280) LOG.debug("HTTP2 Response #{}: unconsumed request content, resetting stream", stream.getId());
607239028 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Greg Wilkins 2015-07-22 07:31:54 +0000 281) stream.reset(new ResetFrame(stream.getId(), ErrorCode.CANCEL_STREAM_ERROR.code), Callback.NOOP);
02b573272 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2015-02-09 08:11:56 +0000 282) }
cf0ecbd88 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-07-21 15:50:08 +0000 282) }
283)
d8961139f jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-05-11 11:57:08 +0000 284) // Consume the existing queued data frames to
d8961139f jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-05-11 11:57:08 +0000 285) // avoid stalling the session flow control.
Expand Down Expand Up @@ -337,7 +337,7 @@ e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 337) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 338) commit = this.commit;
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 339) if (state == State.WRITING)
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 340) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 340) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 341) this.state = State.IDLE;
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 342) callback = this.callback;
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 343) this.callback = null;
Expand All @@ -364,7 +364,7 @@ e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/
7e764bad3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2017-08-22 17:33:46 +0000 364) // Only fail pending writes, as we
7e764bad3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2017-08-22 17:33:46 +0000 365) // may need to write an error page.
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 366) if (state == State.WRITING)
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 367) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 367) {
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 368) this.state = State.FAILED;
e21ad09e3 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-09-05 21:09:12 +0000 369) callback = this.callback;
dd3a73e57 jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java (Simone Bordet 2016-12-14 10:19:49 +0000 370) this.callback = null;
Expand Down
Loading

0 comments on commit d6e4511

Please sign in to comment.