diff --git a/java/maven_install.json b/java/maven_install.json index 2e74813b9fb7c..1208b69b17c46 100644 --- a/java/maven_install.json +++ b/java/maven_install.json @@ -3414,7 +3414,6 @@ "org.openqa.selenium.remote.locators", "org.openqa.selenium.remote.mobile", "org.openqa.selenium.remote.service", - "org.openqa.selenium.remote.session", "org.openqa.selenium.remote.tracing", "org.openqa.selenium.remote.tracing.empty", "org.openqa.selenium.remote.tracing.opentelemetry" diff --git a/java/src/org/openqa/selenium/remote/BUILD.bazel b/java/src/org/openqa/selenium/remote/BUILD.bazel index f53f58687659e..e93f0b4643667 100644 --- a/java/src/org/openqa/selenium/remote/BUILD.bazel +++ b/java/src/org/openqa/selenium/remote/BUILD.bazel @@ -16,8 +16,6 @@ java_export( uses = [ "org.openqa.selenium.devtools.CdpInfo", "org.openqa.selenium.remote.AugmenterProvider", - "org.openqa.selenium.remote.session.CapabilitiesFilter", - "org.openqa.selenium.remote.session.CapabilityTransform", "org.openqa.selenium.remote.service.DriverService$Builder", ], visibility = ["//visibility:public"], diff --git a/java/src/org/openqa/selenium/remote/session/CapabilitiesFilter.java b/java/src/org/openqa/selenium/remote/session/CapabilitiesFilter.java deleted file mode 100644 index 05f221e62bb8d..0000000000000 --- a/java/src/org/openqa/selenium/remote/session/CapabilitiesFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote.session; - -import java.util.Map; -import java.util.function.Function; - -/** - * Takes a stream of capabilities and extracts those that are specific to a browser. - */ -@FunctionalInterface -public interface CapabilitiesFilter extends Function, Map> { - - /** - * Take a map of capabilities and extract those specific to a browser. - * @return a {@link Map} of capabilities if any match, or {@code null} otherwise. - */ - @Override - Map apply(Map capabilities); -} diff --git a/java/src/org/openqa/selenium/remote/session/CapabilityTransform.java b/java/src/org/openqa/selenium/remote/session/CapabilityTransform.java deleted file mode 100644 index 877e99f2f7357..0000000000000 --- a/java/src/org/openqa/selenium/remote/session/CapabilityTransform.java +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote.session; - -import java.util.Collection; -import java.util.Map; -import java.util.function.Function; - -/** - * Takes a capability and allows it to be transformed into 0, 1, or n different capabilities for a - * W3C New Session payload. - */ -@FunctionalInterface -public interface CapabilityTransform - extends Function, Collection>> -{ - - /** - * @return {@code null} to remove the capability, or a collection of {@link Map.Entry} instances. - */ - @Override - Collection> apply(Map.Entry entry); -} diff --git a/java/src/org/openqa/selenium/remote/session/ProxyTransform.java b/java/src/org/openqa/selenium/remote/session/ProxyTransform.java deleted file mode 100644 index 937690f5c5d01..0000000000000 --- a/java/src/org/openqa/selenium/remote/session/ProxyTransform.java +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote.session; - -import org.openqa.selenium.Proxy; - -import java.util.AbstractMap; -import java.util.Collection; -import java.util.Map; -import java.util.TreeMap; - -import static java.util.Collections.singleton; - -public class ProxyTransform implements CapabilityTransform { - - @Override - public Collection> apply(Map.Entry entry) { - if (!"proxy".equals(entry.getKey())) { - return singleton(entry); - } - - Object rawProxy = entry.getValue(); - Map proxy; - if (rawProxy instanceof Proxy) { - proxy = new TreeMap<>(((Proxy) rawProxy).toJson()); - } else { - //noinspection unchecked - proxy = new TreeMap<>((Map) rawProxy); - } - if (proxy.containsKey("proxyType")) { - proxy.put("proxyType", String.valueOf(proxy.get("proxyType")).toLowerCase()); - } - return singleton(new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), proxy)); - } -} diff --git a/java/src/org/openqa/selenium/remote/session/StripAnyPlatform.java b/java/src/org/openqa/selenium/remote/session/StripAnyPlatform.java deleted file mode 100644 index d6e7975f136a7..0000000000000 --- a/java/src/org/openqa/selenium/remote/session/StripAnyPlatform.java +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote.session; - -import java.util.Collection; -import java.util.Map; - -import static java.util.Collections.singleton; -import static org.openqa.selenium.remote.CapabilityType.PLATFORM_NAME; - -public class StripAnyPlatform implements CapabilityTransform { - - @Override - public Collection> apply(Map.Entry entry) { - if (!(PLATFORM_NAME.equals(entry.getKey()))) { - return singleton(entry); - } - - String value = String.valueOf(entry.getValue()).toLowerCase(); - if ("null".equals(value) || - "*".equals(value) || - "any".equals(value)) { - return null; - } - - return singleton(entry); - } -} diff --git a/java/src/org/openqa/selenium/remote/session/W3CPlatformNameNormaliser.java b/java/src/org/openqa/selenium/remote/session/W3CPlatformNameNormaliser.java deleted file mode 100644 index 63c34fc12f99d..0000000000000 --- a/java/src/org/openqa/selenium/remote/session/W3CPlatformNameNormaliser.java +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote.session; - -import static java.util.Collections.singleton; -import static java.util.Locale.ENGLISH; -import static org.openqa.selenium.remote.CapabilityType.PLATFORM_NAME; - -import java.util.AbstractMap; -import java.util.Collection; -import java.util.Map; - -public class W3CPlatformNameNormaliser implements CapabilityTransform { - - @Override - public Collection> apply(Map.Entry entry) { - if (!PLATFORM_NAME.equals(entry.getKey())) { - return singleton(entry); - } - - return singleton(new AbstractMap.SimpleImmutableEntry<>( - entry.getKey(), - String.valueOf(entry.getValue()).toLowerCase(ENGLISH))); - } -}