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

Waffle / waffle / 6516

11 Mar 2026 12:15AM UTC coverage: 46.217%. Remained the same
6516

push

github

web-flow
Update dependency org.eclipse.jdt:ecj to v3.45.0

276 of 734 branches covered (37.6%)

Branch coverage included in aggregate %.

1019 of 2068 relevant lines covered (49.27%)

1.0 hits per line

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

68.0
/Source/JNA/waffle-jna/src/main/java/waffle/windows/auth/impl/WindowsComputerImpl.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2010-2026 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
6
 */
7
package waffle.windows.auth.impl;
8

9
import com.sun.jna.platform.win32.LMJoin;
10
import com.sun.jna.platform.win32.Netapi32Util;
11
import com.sun.jna.platform.win32.Netapi32Util.LocalGroup;
12

13
import java.util.ArrayList;
14
import java.util.List;
15

16
import waffle.windows.auth.IWindowsComputer;
17

18
/**
19
 * Windows Computer.
20
 */
21
public class WindowsComputerImpl implements IWindowsComputer {
22

23
    /** The computer name. */
24
    private final String computerName;
25

26
    /** The domain name. */
27
    private final String domainName;
28

29
    /**
30
     * Instantiates a new windows computer impl.
31
     *
32
     * @param newComputerName
33
     *            the new computer name
34
     */
35
    public WindowsComputerImpl(final String newComputerName) {
2✔
36
        this.computerName = newComputerName;
2✔
37
        this.domainName = Netapi32Util.getDomainName(newComputerName);
2✔
38
    }
2✔
39

40
    @Override
41
    public String getComputerName() {
42
        return this.computerName;
2✔
43
    }
44

45
    @Override
46
    public String[] getGroups() {
47
        final List<String> groupNames = new ArrayList<>();
2✔
48
        final LocalGroup[] groups = Netapi32Util.getLocalGroups(this.computerName);
2✔
49
        for (final LocalGroup group : groups) {
2✔
50
            groupNames.add(group.name);
2✔
51
        }
52
        return groupNames.toArray(new String[0]);
2✔
53
    }
54

55
    @Override
56
    public String getJoinStatus() {
57
        final int joinStatus = Netapi32Util.getJoinStatus(this.computerName);
2✔
58
        switch (joinStatus) {
2!
59
            case LMJoin.NETSETUP_JOIN_STATUS.NetSetupDomainName:
60
                return "NetSetupDomainName";
×
61
            case LMJoin.NETSETUP_JOIN_STATUS.NetSetupUnjoined:
62
                return "NetSetupUnjoined";
×
63
            case LMJoin.NETSETUP_JOIN_STATUS.NetSetupWorkgroupName:
64
                return "NetSetupWorkgroupName";
2✔
65
            case LMJoin.NETSETUP_JOIN_STATUS.NetSetupUnknownStatus:
66
                return "NetSetupUnknownStatus";
×
67
            default:
68
                throw new RuntimeException("Unsupported join status: " + joinStatus);
×
69
        }
70
    }
71

72
    @Override
73
    public String getMemberOf() {
74
        return this.domainName;
2✔
75
    }
76

77
}
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