Copilot commented on code in PR #581: URL: https://github.com/apache/ranger/pull/581#discussion_r2113430635
########## plugin-atlas/src/test/java/org/apache/ranger/authorization/atlas/testutil/RangerAdminClientImpl.java: ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.apache.ranger.authorization.atlas.testutil; + +import org.apache.ranger.admin.client.AbstractRangerAdminClient; +import org.apache.ranger.plugin.util.ServicePolicies; + +import java.io.File; +import java.nio.file.FileSystems; +import java.nio.file.Files; + +/** + * A test implementation of the RangerAdminClient interface that just reads policies in from a file and returns them + */ +public class RangerAdminClientImpl extends AbstractRangerAdminClient { + private static final String TEST_POLICIES_FILENAME = "atlas-policies.json"; + + public ServicePolicies getServicePoliciesIfUpdated(long lastKnownVersion, long lastActivationTimeInMillis) throws Exception { + String basedir = System.getProperty("basedir"); + + if (basedir == null) { + basedir = new File(".").getCanonicalPath(); + } + + java.nio.file.Path cachePath = FileSystems.getDefault().getPath(basedir, "/src/test/resources/" + TEST_POLICIES_FILENAME); Review Comment: Consider removing the leading slash from the path argument ("/src/test/resources/") to ensure consistent path resolution across different operating systems. ```suggestion java.nio.file.Path cachePath = FileSystems.getDefault().getPath(basedir, "src/test/resources/" + TEST_POLICIES_FILENAME); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@ranger.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org