mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-26 03:17:38 +00:00 
			
		
		
		
	Remove some deprecated code
Some of this is technically an API break, but 1.20.4 is pretty unstable. - Remove WiredNetwork from the public API - Remove legacy computer selectors
This commit is contained in:
		| @@ -1,92 +0,0 @@ | ||||
| // SPDX-FileCopyrightText: 2018 The CC: Tweaked Developers | ||||
| // | ||||
| // SPDX-License-Identifier: MPL-2.0 | ||||
| 
 | ||||
| package dan200.computercraft.api.network.wired; | ||||
| 
 | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| import org.jetbrains.annotations.ApiStatus; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * A wired network is composed of one of more {@link WiredNode}s, a set of connections between them, and a series | ||||
|  * of peripherals. | ||||
|  * <p> | ||||
|  * Networks from a connected graph. This means there is some path between all nodes on the network. Further more, if | ||||
|  * there is some path between two nodes then they must be on the same network. {@link WiredNetwork} will automatically | ||||
|  * handle the merging and splitting of networks (and thus changing of available nodes and peripherals) as connections | ||||
|  * change. | ||||
|  * <p> | ||||
|  * This does mean one can not rely on the network remaining consistent between subsequent operations. Consequently, | ||||
|  * it is generally preferred to use the methods provided by {@link WiredNode}. | ||||
|  * | ||||
|  * @see WiredNode#getNetwork() | ||||
|  */ | ||||
| @ApiStatus.NonExtendable | ||||
| public interface WiredNetwork { | ||||
|     /** | ||||
|      * Create a connection between two nodes. | ||||
|      * <p> | ||||
|      * This should only be used on the server thread. | ||||
|      * | ||||
|      * @param left  The first node to connect | ||||
|      * @param right The second node to connect | ||||
|      * @return {@code true} if a connection was created or {@code false} if the connection already exists. | ||||
|      * @throws IllegalStateException    If neither node is on the network. | ||||
|      * @throws IllegalArgumentException If {@code left} and {@code right} are equal. | ||||
|      * @see WiredNode#connectTo(WiredNode) | ||||
|      * @see WiredNetwork#connect(WiredNode, WiredNode) | ||||
|      * @deprecated Use {@link WiredNode#connectTo(WiredNode)} | ||||
|      */ | ||||
|     @Deprecated | ||||
|     boolean connect(WiredNode left, WiredNode right); | ||||
| 
 | ||||
|     /** | ||||
|      * Destroy a connection between this node and another. | ||||
|      * <p> | ||||
|      * This should only be used on the server thread. | ||||
|      * | ||||
|      * @param left  The first node in the connection. | ||||
|      * @param right The second node in the connection. | ||||
|      * @return {@code true} if a connection was destroyed or {@code false} if no connection exists. | ||||
|      * @throws IllegalArgumentException If either node is not on the network. | ||||
|      * @throws IllegalArgumentException If {@code left} and {@code right} are equal. | ||||
|      * @see WiredNode#disconnectFrom(WiredNode) | ||||
|      * @see WiredNetwork#connect(WiredNode, WiredNode) | ||||
|      * @deprecated Use {@link WiredNode#disconnectFrom(WiredNode)} | ||||
|      */ | ||||
|     @Deprecated | ||||
|     boolean disconnect(WiredNode left, WiredNode right); | ||||
| 
 | ||||
|     /** | ||||
|      * Sever all connections this node has, removing it from this network. | ||||
|      * <p> | ||||
|      * This should only be used on the server thread. You should only call this on nodes | ||||
|      * that your network element owns. | ||||
|      * | ||||
|      * @param node The node to remove | ||||
|      * @return Whether this node was removed from the network. One cannot remove a node from a network where it is the | ||||
|      * only element. | ||||
|      * @throws IllegalArgumentException If the node is not in the network. | ||||
|      * @see WiredNode#remove() | ||||
|      * @deprecated Use {@link WiredNode#remove()} | ||||
|      */ | ||||
|     @Deprecated | ||||
|     boolean remove(WiredNode node); | ||||
| 
 | ||||
|     /** | ||||
|      * Update the peripherals a node provides. | ||||
|      * <p> | ||||
|      * This should only be used on the server thread. You should only call this on nodes | ||||
|      * that your network element owns. | ||||
|      * | ||||
|      * @param node        The node to attach peripherals for. | ||||
|      * @param peripherals The new peripherals for this node. | ||||
|      * @throws IllegalArgumentException If the node is not in the network. | ||||
|      * @see WiredNode#updatePeripherals(Map) | ||||
|      * @deprecated Use {@link WiredNode#updatePeripherals(Map)} | ||||
|      */ | ||||
|     @Deprecated | ||||
|     void updatePeripherals(WiredNode node, Map<String, IPeripheral> peripherals); | ||||
| } | ||||
| @@ -11,7 +11,7 @@ import org.jetbrains.annotations.ApiStatus; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * Wired nodes act as a layer between {@link WiredElement}s and {@link WiredNetwork}s. | ||||
|  * A single node on a wired network. | ||||
|  * <p> | ||||
|  * Firstly, a node acts as a packet network, capable of sending and receiving modem messages to connected nodes. These | ||||
|  * methods may be safely used on any thread. | ||||
| @@ -32,18 +32,6 @@ public interface WiredNode extends PacketNetwork { | ||||
|      */ | ||||
|     WiredElement getElement(); | ||||
| 
 | ||||
|     /** | ||||
|      * The network this node is currently connected to. Note that this may change | ||||
|      * after any network operation, so it should not be cached. | ||||
|      * <p> | ||||
|      * This should only be used on the server thread. | ||||
|      * | ||||
|      * @return This node's network. | ||||
|      * @deprecated Use the connect/disconnect/remove methods on {@link WiredNode}. | ||||
|      */ | ||||
|     @Deprecated | ||||
|     WiredNetwork getNetwork(); | ||||
| 
 | ||||
|     /** | ||||
|      * Create a connection from this node to another. | ||||
|      * <p> | ||||
|   | ||||
| @@ -8,10 +8,12 @@ import dan200.computercraft.api.network.PacketSender; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * An object on a {@link WiredNetwork} capable of sending packets. | ||||
|  * An object on a wired network capable of sending packets. | ||||
|  * <p> | ||||
|  * Unlike a regular {@link PacketSender}, this must be associated with the node you are attempting to | ||||
|  * to send the packet from. | ||||
|  * | ||||
|  * @see WiredElement | ||||
|  */ | ||||
| public interface WiredSender extends PacketSender { | ||||
|     /** | ||||
|   | ||||
| @@ -5,7 +5,6 @@ | ||||
| package dan200.computercraft.impl.network.wired; | ||||
| 
 | ||||
| import dan200.computercraft.api.network.Packet; | ||||
| import dan200.computercraft.api.network.wired.WiredNetwork; | ||||
| import dan200.computercraft.api.network.wired.WiredNode; | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| import dan200.computercraft.core.util.Nullability; | ||||
| @@ -14,7 +13,7 @@ import java.util.*; | ||||
| import java.util.concurrent.locks.ReadWriteLock; | ||||
| import java.util.concurrent.locks.ReentrantReadWriteLock; | ||||
| 
 | ||||
| final class WiredNetworkImpl implements WiredNetwork { | ||||
| final class WiredNetworkImpl { | ||||
|     final ReadWriteLock lock = new ReentrantReadWriteLock(); | ||||
|     Set<WiredNodeImpl> nodes; | ||||
|     private Map<String, IPeripheral> peripherals = new HashMap<>(); | ||||
| @@ -28,7 +27,6 @@ final class WiredNetworkImpl implements WiredNetwork { | ||||
|         this.nodes = nodes; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean connect(WiredNode nodeU, WiredNode nodeV) { | ||||
|         var wiredU = checkNode(nodeU); | ||||
|         var wiredV = checkNode(nodeV); | ||||
| @@ -88,7 +86,6 @@ final class WiredNetworkImpl implements WiredNetwork { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean disconnect(WiredNode nodeU, WiredNode nodeV) { | ||||
|         var wiredU = checkNode(nodeU); | ||||
|         var wiredV = checkNode(nodeV); | ||||
| @@ -159,7 +156,6 @@ final class WiredNetworkImpl implements WiredNetwork { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(WiredNode node) { | ||||
|         var wired = checkNode(node); | ||||
| 
 | ||||
| @@ -316,7 +312,6 @@ final class WiredNetworkImpl implements WiredNetwork { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void updatePeripherals(WiredNode node, Map<String, IPeripheral> newPeripherals) { | ||||
|         var wired = checkNode(node); | ||||
|         Objects.requireNonNull(peripherals, "peripherals cannot be null"); | ||||
|   | ||||
| @@ -4,10 +4,10 @@ | ||||
| 
 | ||||
| package dan200.computercraft.impl.network.wired; | ||||
| 
 | ||||
| import com.google.common.annotations.VisibleForTesting; | ||||
| import dan200.computercraft.api.network.Packet; | ||||
| import dan200.computercraft.api.network.PacketReceiver; | ||||
| import dan200.computercraft.api.network.wired.WiredElement; | ||||
| import dan200.computercraft.api.network.wired.WiredNetwork; | ||||
| import dan200.computercraft.api.network.wired.WiredNode; | ||||
| import dan200.computercraft.api.network.wired.WiredSender; | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| @@ -128,8 +128,8 @@ public final class WiredNodeImpl implements WiredNode { | ||||
|         return element; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public WiredNetwork getNetwork() { | ||||
|     @VisibleForTesting | ||||
|     public WiredNetworkImpl getNetwork() { | ||||
|         return network; | ||||
|     } | ||||
| 
 | ||||
|   | ||||
| @@ -159,7 +159,6 @@ public final class CommandComputerCraft { | ||||
|      */ | ||||
|     private static int dumpComputer(CommandSourceStack source, ServerComputer computer) { | ||||
|         var table = new TableBuilder("Dump"); | ||||
|         table.row(header("Instance ID"), text(Integer.toString(computer.getInstanceID()))); | ||||
|         table.row(header("Instance UUID"), text(computer.getInstanceUUID().toString())); | ||||
|         table.row(header("Id"), text(Integer.toString(computer.getID()))); | ||||
|         table.row(header("Label"), text(computer.getLabel())); | ||||
|   | ||||
| @@ -35,7 +35,6 @@ import static dan200.computercraft.shared.command.text.ChatHelpers.makeComputerD | ||||
| 
 | ||||
| public record ComputerSelector( | ||||
|     String selector, | ||||
|     OptionalInt instanceId, | ||||
|     @Nullable UUID instanceUuid, | ||||
|     OptionalInt computerId, | ||||
|     @Nullable String label, | ||||
| @@ -43,9 +42,9 @@ public record ComputerSelector( | ||||
|     @Nullable AABB bounds, | ||||
|     @Nullable MinMaxBounds.Doubles range | ||||
| ) { | ||||
|     private static final ComputerSelector all = new ComputerSelector("@c[]", OptionalInt.empty(), null, OptionalInt.empty(), null, null, null, null); | ||||
|     private static final ComputerSelector all = new ComputerSelector("@c[]", null, OptionalInt.empty(), null, null, null, null); | ||||
| 
 | ||||
|     private static UuidArgument uuidArgument = UuidArgument.uuid(); | ||||
|     private static final UuidArgument uuidArgument = UuidArgument.uuid(); | ||||
| 
 | ||||
|     /** | ||||
|      * A {@link ComputerSelector} which matches all computers. | ||||
| @@ -64,10 +63,6 @@ public record ComputerSelector( | ||||
|      */ | ||||
|     public Stream<ServerComputer> find(CommandSourceStack source) { | ||||
|         var context = ServerContext.get(source.getServer()); | ||||
|         if (instanceId().isPresent()) { | ||||
|             var computer = context.registry().get(instanceId().getAsInt()); | ||||
|             return computer != null && matches(source, computer) ? Stream.of(computer) : Stream.of(); | ||||
|         } | ||||
| 
 | ||||
|         if (instanceUuid() != null) { | ||||
|             var computer = context.registry().get(instanceUuid()); | ||||
| @@ -114,8 +109,7 @@ public record ComputerSelector( | ||||
|      * @return If this computer is matched by the selector. | ||||
|      */ | ||||
|     public boolean matches(CommandSourceStack source, ServerComputer computer) { | ||||
|         return (instanceId().isEmpty() || computer.getInstanceID() == instanceId().getAsInt()) | ||||
|             && (instanceUuid() == null || computer.getInstanceUUID().equals(instanceUuid())) | ||||
|         return (instanceUuid() == null || computer.getInstanceUUID().equals(instanceUuid())) | ||||
|             && (computerId().isEmpty() || computer.getID() == computerId().getAsInt()) | ||||
|             && (label == null || Objects.equals(computer.getLabel(), label)) | ||||
|             && (family == null || computer.getFamily() == family) | ||||
| @@ -138,24 +132,12 @@ public record ComputerSelector( | ||||
|         if (consume(reader, "@c[")) { | ||||
|             parseSelector(builder, reader); | ||||
|         } else { | ||||
|             // TODO(1.20.5): Only parse computer ids here. | ||||
|             var kind = reader.peek(); | ||||
|             if (kind == '@') { | ||||
|                 reader.skip(); | ||||
|                 builder.label = reader.readString(); | ||||
|             } else if (kind == '~') { | ||||
|                 reader.skip(); | ||||
|                 builder.family = parseFamily(reader); | ||||
|             } else if (kind == '#') { | ||||
|                 reader.skip(); | ||||
|                 builder.computerId = OptionalInt.of(reader.readInt()); | ||||
|             } else { | ||||
|                 builder.instanceId = OptionalInt.of(reader.readInt()); | ||||
|             } | ||||
|             if (reader.peek() == '#') reader.skip(); | ||||
|             builder.computerId = OptionalInt.of(reader.readInt()); | ||||
|         } | ||||
| 
 | ||||
|         var selector = reader.getString().substring(start, reader.getCursor()); | ||||
|         return new ComputerSelector(selector, builder.instanceId, builder.instanceUuid, builder.computerId, builder.label, builder.family, builder.bounds, builder.range); | ||||
|         return new ComputerSelector(selector, builder.instanceUuid, builder.computerId, builder.label, builder.family, builder.bounds, builder.range); | ||||
|     } | ||||
| 
 | ||||
|     private static void parseSelector(Builder builder, StringReader reader) throws CommandSyntaxException { | ||||
| @@ -222,7 +204,7 @@ public record ComputerSelector( | ||||
|         } else if (remaining.startsWith("#")) { | ||||
|             return suggestComputers(c -> "#" + c.getID()).suggest(context, builder); | ||||
|         } else { | ||||
|             return suggestComputers(c -> Integer.toString(c.getInstanceID())).suggest(context, builder); | ||||
|             return suggestComputers(c -> Integer.toString(c.getID())).suggest(context, builder); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|   | ||||
| @@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicBoolean; | ||||
| import java.util.function.Function; | ||||
| 
 | ||||
| public class ServerComputer implements InputHandler, ComputerEnvironment { | ||||
|     private final int instanceID; | ||||
|     private final UUID instanceUUID = UUID.randomUUID(); | ||||
| 
 | ||||
|     private ServerLevel level; | ||||
| @@ -54,7 +53,6 @@ public class ServerComputer implements InputHandler, ComputerEnvironment { | ||||
|         this.family = family; | ||||
| 
 | ||||
|         var context = ServerContext.get(level.getServer()); | ||||
|         instanceID = context.registry().getUnusedInstanceID(); | ||||
|         terminal = new NetworkedTerminal(terminalWidth, terminalHeight, family != ComputerFamily.NORMAL, this::markTerminalChanged); | ||||
|         metrics = context.metrics().createMetricObserver(this); | ||||
| 
 | ||||
| @@ -148,10 +146,6 @@ public class ServerComputer implements InputHandler, ComputerEnvironment { | ||||
|     protected void onRemoved() { | ||||
|     } | ||||
| 
 | ||||
|     public int getInstanceID() { | ||||
|         return instanceID; | ||||
|     } | ||||
| 
 | ||||
|     public UUID getInstanceUUID() { | ||||
|         return instanceUUID; | ||||
|     } | ||||
|   | ||||
| @@ -4,9 +4,6 @@ | ||||
| 
 | ||||
| package dan200.computercraft.shared.computer.core; | ||||
| 
 | ||||
| import it.unimi.dsi.fastutil.ints.Int2ObjectMap; | ||||
| import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; | ||||
| 
 | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.*; | ||||
| 
 | ||||
| @@ -14,23 +11,12 @@ public class ServerComputerRegistry { | ||||
|     private static final Random RANDOM = new Random(); | ||||
| 
 | ||||
|     private final int sessionId = RANDOM.nextInt(); | ||||
|     private final Int2ObjectMap<ServerComputer> computersByInstanceId = new Int2ObjectOpenHashMap<>(); | ||||
|     private final Map<UUID, ServerComputer> computersByInstanceUuid = new HashMap<>(); | ||||
|     private int nextInstanceId; | ||||
| 
 | ||||
|     public int getSessionID() { | ||||
|         return sessionId; | ||||
|     } | ||||
| 
 | ||||
|     int getUnusedInstanceID() { | ||||
|         return nextInstanceId++; | ||||
|     } | ||||
| 
 | ||||
|     @Nullable | ||||
|     public ServerComputer get(int instanceID) { | ||||
|         return instanceID >= 0 ? computersByInstanceId.get(instanceID) : null; | ||||
|     } | ||||
| 
 | ||||
|     @Nullable | ||||
|     public ServerComputer get(@Nullable UUID instanceID) { | ||||
|         return instanceID != null ? computersByInstanceUuid.get(instanceID) : null; | ||||
| @@ -56,35 +42,27 @@ public class ServerComputerRegistry { | ||||
|     } | ||||
| 
 | ||||
|     void add(ServerComputer computer) { | ||||
|         var instanceID = computer.getInstanceID(); | ||||
|         var instanceUUID = computer.getInstanceUUID(); | ||||
| 
 | ||||
|         if (computersByInstanceId.containsKey(instanceID)) { | ||||
|             throw new IllegalStateException("Duplicate computer " + instanceID); | ||||
|         } | ||||
| 
 | ||||
|         if (computersByInstanceUuid.containsKey(instanceUUID)) { | ||||
|             throw new IllegalStateException("Duplicate computer " + instanceUUID); | ||||
|         } | ||||
| 
 | ||||
|         computersByInstanceId.put(instanceID, computer); | ||||
|         computersByInstanceUuid.put(instanceUUID, computer); | ||||
|     } | ||||
| 
 | ||||
|     void remove(ServerComputer computer) { | ||||
|         computer.unload(); | ||||
|         computer.onRemoved(); | ||||
|         computersByInstanceId.remove(computer.getInstanceID()); | ||||
|         computersByInstanceUuid.remove(computer.getInstanceUUID()); | ||||
|     } | ||||
| 
 | ||||
|     void close() { | ||||
|         for (var computer : getComputers()) computer.unload(); | ||||
|         computersByInstanceId.clear(); | ||||
|         computersByInstanceUuid.clear(); | ||||
|     } | ||||
| 
 | ||||
|     public Collection<ServerComputer> getComputers() { | ||||
|         return computersByInstanceId.values(); | ||||
|         return computersByInstanceUuid.values(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| 
 | ||||
| package dan200.computercraft.impl.network.wired; | ||||
| 
 | ||||
| import dan200.computercraft.api.network.wired.WiredNetwork; | ||||
| import dan200.computercraft.impl.network.wired.NetworkTest.NetworkElement; | ||||
| import dan200.computercraft.shared.util.DirectionUtil; | ||||
| import it.unimi.dsi.fastutil.objects.Object2IntMap; | ||||
| @@ -136,8 +135,8 @@ public class NetworkBenchmark { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private static Object2IntMap<WiredNetwork> countNetworks(Grid<WiredNodeImpl> grid) { | ||||
|         Object2IntMap<WiredNetwork> networks = new Object2IntOpenHashMap<>(); | ||||
|     private static Object2IntMap<WiredNetworkImpl> countNetworks(Grid<WiredNodeImpl> grid) { | ||||
|         Object2IntMap<WiredNetworkImpl> networks = new Object2IntOpenHashMap<>(); | ||||
|         grid.forEach((node, pos) -> networks.put(node.network, networks.getOrDefault(node.network, 0) + 1)); | ||||
|         return networks; | ||||
|     } | ||||
|   | ||||
| @@ -5,7 +5,6 @@ | ||||
| package dan200.computercraft.impl.network.wired; | ||||
| 
 | ||||
| import dan200.computercraft.api.network.wired.WiredElement; | ||||
| import dan200.computercraft.api.network.wired.WiredNetwork; | ||||
| import dan200.computercraft.api.network.wired.WiredNetworkChange; | ||||
| import dan200.computercraft.api.network.wired.WiredNode; | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| @@ -293,8 +292,8 @@ public class NetworkTest { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private static Set<WiredNodeImpl> nodes(WiredNetwork network) { | ||||
|         return ((WiredNetworkImpl) network).nodes; | ||||
|     private static Set<WiredNodeImpl> nodes(WiredNetworkImpl network) { | ||||
|         return network.nodes; | ||||
|     } | ||||
| 
 | ||||
|     private static Set<WiredNodeImpl> neighbours(WiredNode node) { | ||||
|   | ||||
| @@ -39,20 +39,17 @@ class ComputerSelectorTest { | ||||
| 
 | ||||
|     public static Arguments[] getArgumentTestCases() { | ||||
|         return new Arguments[]{ | ||||
|             // Legacy selectors | ||||
|             Arguments.of("@some_label", new ComputerSelector("@some_label", OptionalInt.empty(), null, OptionalInt.empty(), "some_label", null, null, null)), | ||||
|             Arguments.of("~normal", new ComputerSelector("~normal", OptionalInt.empty(), null, OptionalInt.empty(), null, ComputerFamily.NORMAL, null, null)), | ||||
|             Arguments.of("#123", new ComputerSelector("#123", OptionalInt.empty(), null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("123", new ComputerSelector("123", OptionalInt.of(123), null, OptionalInt.empty(), null, null, null, null)), | ||||
|             Arguments.of("#123", new ComputerSelector("#123", null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("123", new ComputerSelector("123", null, OptionalInt.of(123), null, null, null, null)), | ||||
|             // New selectors | ||||
|             Arguments.of("@c[]", new ComputerSelector("@c[]", OptionalInt.empty(), null, OptionalInt.empty(), null, null, null, null)), | ||||
|             Arguments.of("@c[instance=5e18f505-62f7-46f8-83f3-792f03224724]", new ComputerSelector("@c[instance=5e18f505-62f7-46f8-83f3-792f03224724]", OptionalInt.empty(), UUID.fromString("5e18f505-62f7-46f8-83f3-792f03224724"), OptionalInt.empty(), null, null, null, null)), | ||||
|             Arguments.of("@c[id=123]", new ComputerSelector("@c[id=123]", OptionalInt.empty(), null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("@c[label=\"foo\"]", new ComputerSelector("@c[label=\"foo\"]", OptionalInt.empty(), null, OptionalInt.empty(), "foo", null, null, null)), | ||||
|             Arguments.of("@c[family=normal]", new ComputerSelector("@c[family=normal]", OptionalInt.empty(), null, OptionalInt.empty(), null, ComputerFamily.NORMAL, null, null)), | ||||
|             Arguments.of("@c[]", new ComputerSelector("@c[]", null, OptionalInt.empty(), null, null, null, null)), | ||||
|             Arguments.of("@c[instance=5e18f505-62f7-46f8-83f3-792f03224724]", new ComputerSelector("@c[instance=5e18f505-62f7-46f8-83f3-792f03224724]", UUID.fromString("5e18f505-62f7-46f8-83f3-792f03224724"), OptionalInt.empty(), null, null, null, null)), | ||||
|             Arguments.of("@c[id=123]", new ComputerSelector("@c[id=123]", null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("@c[label=\"foo\"]", new ComputerSelector("@c[label=\"foo\"]", null, OptionalInt.empty(), "foo", null, null, null)), | ||||
|             Arguments.of("@c[family=normal]", new ComputerSelector("@c[family=normal]", null, OptionalInt.empty(), null, ComputerFamily.NORMAL, null, null)), | ||||
|             // Complex selectors | ||||
|             Arguments.of("@c[ id = 123 , ]", new ComputerSelector("@c[ id = 123 , ]", OptionalInt.empty(), null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("@c[id=123,family=normal]", new ComputerSelector("@c[id=123,family=normal]", OptionalInt.empty(), null, OptionalInt.of(123), null, ComputerFamily.NORMAL, null, null)), | ||||
|             Arguments.of("@c[ id = 123 , ]", new ComputerSelector("@c[ id = 123 , ]", null, OptionalInt.of(123), null, null, null, null)), | ||||
|             Arguments.of("@c[id=123,family=normal]", new ComputerSelector("@c[id=123,family=normal]", null, OptionalInt.of(123), null, ComputerFamily.NORMAL, null, null)), | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonathan Coates
					Jonathan Coates