Class CreateGarbageCommand

  • All Implemented Interfaces:
    Command

    public class CreateGarbageCommand
    extends Object
    implements Command
    CreateGarbageCommand creates garbage nodes in the repository in order to allow for testing fullGC functionality.
    • Field Detail

      • GARBAGE_GEN_ROOT_PATH_BASE

        public static String GARBAGE_GEN_ROOT_PATH_BASE
        Garbage should be generated under tmp node.
      • GARBAGE_GEN_ROOT_NODE_NAME

        public static String GARBAGE_GEN_ROOT_NODE_NAME
        The root node name for garbage generation, one level under tmp.
      • GARBAGE_GEN_ROOT_PATH

        public static String GARBAGE_GEN_ROOT_PATH
        Root node for garbage generation. Necessary in order to allow cleanup of all generated garbage nodes by simply removing the root node.
      • GEN_BASE_PATH

        public static String GEN_BASE_PATH
        Base path for garbage generation. The timestamp of the run will be appended to this path, which is necessary in order for each garbage generation run to be unique and not overwrite previous ones. If continuous generation is enabled, the index of the run will also be appended to this path.
      • GEN_PARENT_NODE_PREFIX

        public static String GEN_PARENT_NODE_PREFIX
        Prefix for parent nodes under which garbage nodes will be created. The index of the parent node will be appended to this prefix.
      • GEN_NODE_PREFIX

        public static String GEN_NODE_PREFIX
      • GEN_NODE_LEVEL_PREFIX

        public static String GEN_NODE_LEVEL_PREFIX
      • EMPTY_PROPERTY_NAME

        public static String EMPTY_PROPERTY_NAME
    • Constructor Detail

      • CreateGarbageCommand

        public CreateGarbageCommand()
    • Method Detail

      • execute

        public List<String> execute​(Closer closer,
                                    boolean isTest,
                                    String... args)
                             throws Exception
        Method with passed closer is necessary in order to allow for unit tests to check the output of the command. It is the responsibility of the caller to close the closer. Returns the list of generated garbage base paths (under the garbage root node).
        Parameters:
        closer -
        args -
        Throws:
        Exception
      • generateGapOrphanNodePaths

        public static List<String> generateGapOrphanNodePaths​(String generationBasePath,
                                                              int parentIndex,
                                                              int nodeIndex,
                                                              int gapDepth,
                                                              int gapLevelGap,
                                                              boolean fromLevelGapToLeaf)
        Gets the paths of the nodes between the parent node and the level gap OR between the level gap and the leaf gap orphan node. Example 1: gapDepth = 4, gapLevelGap = 2, fromLevelGapToLeaf = false will return: - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1 - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2 and will NOT return the rest of the nodes: - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2/Node_0_Level_3 - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2/Node_0_Level_3/Node_0 (the leaf node) Example 2: gapDepth = 5, gapLevelGap = 2, fromLevelGapToLeaf = true will return: - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2/Node_0_Level_3 - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2/Node_0_Level_3/Node_0_Level_4 - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2/Node_0_Level_3/Node_0_Level_4/Node_0 (the leaf node) and will NOT return the nodes from the parent to the gap level: - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1 - /tmp/oak-run-created-test-garbage/GenTest_[timestamp]_0/Parent_0/Node_0_Level_1/Node_0_Level_2
        Parameters:
        generationBasePath -
        parentIndex -
        nodeIndex -
        gapDepth - - the depth in the tree until which to create gap orphan garbage nodes.
        gapLevelGap - - the gap in the tree between the first gap orphan garbage node and its parent.
        fromLevelGapToLeaf - - if true, the paths will be generated from the level gap to the leaf node, otherwise the paths will be generated from the parent node to the level gap.
        Returns: