1
0

hdfs-allow-snapshot-mock.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef LIBHDFSPP_TOOLS_HDFS_ALLOW_SNAPSHOT_MOCK
  19. #define LIBHDFSPP_TOOLS_HDFS_ALLOW_SNAPSHOT_MOCK
  20. #include <string>
  21. #include "hdfs-allow-snapshot.h"
  22. namespace hdfs::tools::test {
  23. /**
  24. * {@class AllowSnapshotMock} is an {@class AllowSnapshot} whereby it mocks the
  25. * HandleHelp and HandlePath methods for testing their functionality.
  26. */
  27. class AllowSnapshotMock : public hdfs::tools::AllowSnapshot {
  28. public:
  29. /**
  30. * {@inheritdoc}
  31. */
  32. AllowSnapshotMock(const int argc, char **argv) : AllowSnapshot(argc, argv) {}
  33. // Abiding to the Rule of 5
  34. AllowSnapshotMock(const AllowSnapshotMock &) = default;
  35. AllowSnapshotMock(AllowSnapshotMock &&) = default;
  36. AllowSnapshotMock &operator=(const AllowSnapshotMock &) = delete;
  37. AllowSnapshotMock &operator=(AllowSnapshotMock &&) = delete;
  38. ~AllowSnapshotMock() override = default;
  39. /**
  40. * {@inheritdoc}
  41. */
  42. [[nodiscard]] bool HandleHelp() const override;
  43. /**
  44. * {@inheritdoc}
  45. */
  46. [[nodiscard]] bool HandlePath(const std::string &path) const override;
  47. };
  48. } // namespace hdfs::tools::test
  49. #endif