Add unit test for FrontedMetadata memory leaks
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / TestShard.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore;
9
10 import org.opendaylight.controller.cluster.datastore.persisted.FrontendShardDataTreeSnapshotMetadata;
11
12 public class TestShard extends Shard {
13     // Message to request FrontendMetadata
14     public static final class RequestFrontendMetadata {
15
16     }
17
18     protected TestShard(AbstractBuilder<?, ?> builder) {
19         super(builder);
20     }
21
22     @Override
23     protected void handleNonRaftCommand(Object message) {
24         if (message instanceof  RequestFrontendMetadata) {
25             FrontendShardDataTreeSnapshotMetadata metadataSnapshot = frontendMetadata.toSnapshot();
26             sender().tell(metadataSnapshot, self());
27         } else {
28             super.handleNonRaftCommand(message);
29         }
30     }
31
32     public static Shard.Builder builder() {
33         return new TestShard.Builder();
34     }
35
36     public static class Builder extends Shard.Builder {
37         Builder() {
38             super(TestShard.class);
39         }
40     }
41 }
42

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.