Ethanlm commented on a change in pull request #3244: [STORM-3600] Add caching in Cluster.calculateSharedOffHeapNodeMemory URL: https://github.com/apache/storm/pull/3244#discussion_r406457877
########## File path: storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestTopologyAnonymizerUtils.java ########## @@ -0,0 +1,355 @@ +/** + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.storm.scheduler.resource.strategies.scheduling; + +import org.apache.storm.Config; +import org.apache.storm.DaemonConfig; +import org.apache.storm.generated.Bolt; +import org.apache.storm.generated.GlobalStreamId; +import org.apache.storm.generated.SpoutSpec; +import org.apache.storm.generated.StormTopology; +import org.apache.storm.serialization.GzipThriftSerializationDelegate; +import org.apache.storm.utils.Utils; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Anonymize Serialized Topologies and Configs with the goal of taking internally developed topologies and configuration + * and make them publicly available for testing. + * + * Assume that topologies and configurations exist in the specified resource directory with names ending in stormcode.ser + * and stormconf.ser respectively as they exist in blobstore. Also, stormconf.ser file shares the same name prefix with + * the topology serialized file. + * + * <li> Rename topologies and its corresponding configuration (as identified by its resource name). Ensure that renamed + * configuration file for a topology retains the proper linkage so that: + * <p><old-topo-name>-stormcode.ser -> <new-topo-name>-stormcode.ser</p> and its old conf + * <p><old-topo-name>-stormconf.ser -> <new-topo-name>-stormconf.ser</p> + * </li> + * + * <li>Rename components in each of the topologies.</li> + * + * The new converted resource files can be copied to a resource directory under "clusterconf" and made available for use + * in TestLargeCluster class. + */ +public class TestTopologyAnonymizerUtils { + private static final Logger LOG = LoggerFactory.getLogger(TestTopologyAnonymizerUtils.class); + + private static final String DEFAULT_ORIGINAL_RESOURCES_PATH = "clusterconf/iridiumblue"; + private static final String DEFAULT_ANONYMIZED_RESOURCES_OUTDIR = "src/test/resources/clusterconf/largeCluster01"; + + private String originalResourcePath; + private String outputDirPath; + + public TestTopologyAnonymizerUtils() { + this.originalResourcePath = DEFAULT_ORIGINAL_RESOURCES_PATH; + this.outputDirPath = DEFAULT_ANONYMIZED_RESOURCES_OUTDIR; + } + + //public TestTopologyAnonymizerUtils(String originalResourcePath, String outputDirPath) { Review comment: Maybe clean up the comments if they are not needed ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services