• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Dynatrace / openkit-java / #421079375

pending completion
#421079375

push

github-actions

openkitdt
<a href="https://github.com/Dynatrace/openkit-java/commit/<a class=hub.com/Dynatrace/openkit-java/commit/ed2274a4e4a28843476d42db8f7285a0099e911c">ed2274a4e<a href="https://github.com/Dynatrace/openkit-java/commit/ed2274a4e4a28843476d42db8f7285a0099e911c">&quot;&gt;Pull request #253: RUM-9059 Fixing HTTPClienTest for Java7

Merge in OP/openkit-java from feature/RUM-9059-mockito-4.x-update-destroyed-compatibility-with-java-7-for-open-kit-java to main

* commit &#39;</a><a class="double-link" href="https://github.com/Dynatrace/openkit-java/commit/<a class="double-link" href="https://github.com/Dynatrace/openkit-java/commit/923e0932da7ec3711020378f886a407411ad1015">923e0932d</a>">923e0932d</a><a href="https://github.com/Dynatrace/openkit-java/commit/ed2274a4e4a28843476d42db8f7285a0099e911c">&#39;:
  RUM-9059 Fixing HTTPClienTest for Java7

GitOrigin-RevId: 87bb8509b">87bb8509b</a>

4148 of 4352 relevant lines covered (95.31%)

0.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.0
/src/main/java/com/dynatrace/openkit/core/communication/BeaconSendingFlushSessionsState.java
1
/**
2
 * Copyright 2018-2021 Dynatrace LLC
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.dynatrace.openkit.core.communication;
18

19
import com.dynatrace.openkit.core.objects.SessionImpl;
20
import com.dynatrace.openkit.protocol.StatusResponse;
21

22
import java.util.List;
23

24
/**
25
 * In this state open sessions are finished. After that all sessions are sent to the server.
26
 * <p>
27
 *     Transition to:
28
 *     <ul>
29
 *         <li>{@link BeaconSendingTerminalState}</li>
30
 *     </ul>
31
 * </p>
32
 */
33
class BeaconSendingFlushSessionsState extends AbstractBeaconSendingState {
34

35
    BeaconSendingFlushSessionsState() {
36
        super(false);
1✔
37
    }
1✔
38

39
    @Override
40
    void doExecute(BeaconSendingContext context) {
41

42
        // first get all sessions that were not yet configured
43
        List<SessionImpl> notConfiguredSessions = context.getAllNotConfiguredSessions();
1✔
44
        for (SessionImpl newSession : notConfiguredSessions) {
1✔
45
            // just turn on the capturing and send all remaining data
46
            newSession.enableCapture();
×
47
        }
×
48

49
        // end open sessions -> will be flushed afterwards
50
        List<SessionImpl> openSessions = context.getAllOpenAndConfiguredSessions();
1✔
51
        for (SessionImpl openSession : openSessions) {
1✔
52
            openSession.end(false);
1✔
53
        }
1✔
54

55
        // flush already finished (and previously ended) sessions
56
        boolean tooManyRequestsReceived = false;
1✔
57
        List<SessionImpl> finishedSessions = context.getAllFinishedAndConfiguredSessions();
1✔
58
        for (SessionImpl finishedSession : finishedSessions) {
1✔
59
            if (!tooManyRequestsReceived && finishedSession.isDataSendingAllowed()) {
1✔
60
                StatusResponse response = finishedSession.sendBeacon(context.getHTTPClientProvider(), context);
1✔
61
                if (BeaconSendingResponseUtil.isTooManyRequestsResponse(response)) {
1✔
62
                    tooManyRequestsReceived = true;
×
63
                }
64
            }
65
            finishedSession.clearCapturedData();
1✔
66
            finishedSession.close(); // The session is already closed/ended at this point. This call avoids a static code warning.
1✔
67
            context.removeSession(finishedSession);
1✔
68
        }
1✔
69

70
        // make last state transition to terminal state
71
        context.setNextState(new BeaconSendingTerminalState());
1✔
72
    }
1✔
73

74
    @Override
75
    AbstractBeaconSendingState getShutdownState() {
76
        return new BeaconSendingTerminalState();
1✔
77
    }
78

79
    @Override
80
    public String toString() {
81
        return "FlushSessions";
1✔
82
    }
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc