Committed by
Gerrit Code Review
Make all leaf intent classes immutable
Change-Id: I45a9ac42a401b707c0c0d91f2e55294f3571ca25
Showing
12 changed files
with
192 additions
and
10 deletions
... | @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList; | ... | @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList; |
22 | /** | 22 | /** |
23 | * Abstraction of MPLS label-switched connectivity. | 23 | * Abstraction of MPLS label-switched connectivity. |
24 | */ | 24 | */ |
25 | -public class MplsIntent extends ConnectivityIntent { | 25 | +public final class MplsIntent extends ConnectivityIntent { |
26 | 26 | ||
27 | private final ConnectPoint ingressPoint; | 27 | private final ConnectPoint ingressPoint; |
28 | private final Optional<MplsLabel> ingressLabel; | 28 | private final Optional<MplsLabel> ingressLabel; | ... | ... |
... | @@ -18,10 +18,10 @@ import org.onosproject.net.flow.TrafficTreatment; | ... | @@ -18,10 +18,10 @@ import org.onosproject.net.flow.TrafficTreatment; |
18 | * Abstraction of explicit MPLS label-switched path. | 18 | * Abstraction of explicit MPLS label-switched path. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | -public class MplsPathIntent extends PathIntent { | 21 | +public final class MplsPathIntent extends PathIntent { |
22 | 22 | ||
23 | - private Optional<MplsLabel> ingressLabel; | 23 | + private final Optional<MplsLabel> ingressLabel; |
24 | - private Optional<MplsLabel> egressLabel; | 24 | + private final Optional<MplsLabel> egressLabel; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Creates a new point-to-point intent with the supplied ingress/egress | 27 | * Creates a new point-to-point intent with the supplied ingress/egress | ... | ... |
... | @@ -24,9 +24,9 @@ import java.util.Collections; | ... | @@ -24,9 +24,9 @@ import java.util.Collections; |
24 | * An optical layer intent for connectivity from one transponder port to another | 24 | * An optical layer intent for connectivity from one transponder port to another |
25 | * transponder port. No traffic selector or traffic treatment are needed. | 25 | * transponder port. No traffic selector or traffic treatment are needed. |
26 | */ | 26 | */ |
27 | -public class OpticalConnectivityIntent extends Intent { | 27 | +public final class OpticalConnectivityIntent extends Intent { |
28 | - protected final ConnectPoint src; | 28 | + private final ConnectPoint src; |
29 | - protected final ConnectPoint dst; | 29 | + private final ConnectPoint dst; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Creates an optical connectivity intent between the specified | 32 | * Creates an optical connectivity intent between the specified | ... | ... |
... | @@ -24,7 +24,7 @@ import org.onosproject.net.Path; | ... | @@ -24,7 +24,7 @@ import org.onosproject.net.Path; |
24 | 24 | ||
25 | import java.util.Collection; | 25 | import java.util.Collection; |
26 | 26 | ||
27 | -public class OpticalPathIntent extends Intent { | 27 | +public final class OpticalPathIntent extends Intent { |
28 | 28 | ||
29 | private final ConnectPoint src; | 29 | private final ConnectPoint src; |
30 | private final ConnectPoint dst; | 30 | private final ConnectPoint dst; | ... | ... |
... | @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; |
33 | /** | 33 | /** |
34 | * Abstraction of point-to-point connectivity. | 34 | * Abstraction of point-to-point connectivity. |
35 | */ | 35 | */ |
36 | -public class PointToPointIntent extends ConnectivityIntent { | 36 | +public final class PointToPointIntent extends ConnectivityIntent { |
37 | 37 | ||
38 | private final ConnectPoint ingressPoint; | 38 | private final ConnectPoint ingressPoint; |
39 | private final ConnectPoint egressPoint; | 39 | private final ConnectPoint egressPoint; | ... | ... |
... | @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; |
33 | /** | 33 | /** |
34 | * Abstraction of single source, multiple destination connectivity intent. | 34 | * Abstraction of single source, multiple destination connectivity intent. |
35 | */ | 35 | */ |
36 | -public class SinglePointToMultiPointIntent extends ConnectivityIntent { | 36 | +public final class SinglePointToMultiPointIntent extends ConnectivityIntent { |
37 | 37 | ||
38 | private final ConnectPoint ingressPoint; | 38 | private final ConnectPoint ingressPoint; |
39 | private final Set<ConnectPoint> egressPoints; | 39 | private final Set<ConnectPoint> egressPoints; | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.intent; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | + | ||
20 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | + | ||
22 | +/** | ||
23 | + * Unit tests for the MplsIntent class. | ||
24 | + */ | ||
25 | + | ||
26 | +public class MplsIntentTest { | ||
27 | + | ||
28 | + /** | ||
29 | + * Checks that the MplsIntent class is immutable. | ||
30 | + */ | ||
31 | + @Test | ||
32 | + public void testImmutability() { | ||
33 | + assertThatClassIsImmutable(MplsIntent.class); | ||
34 | + } | ||
35 | + | ||
36 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.intent; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | + | ||
20 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | + | ||
22 | +/** | ||
23 | + * Unit tests for the MplsPathIntent class. | ||
24 | + */ | ||
25 | +public class MplsPathIntentTest { | ||
26 | + | ||
27 | + /** | ||
28 | + * Checks that the MplsPathIntent class is immutable. | ||
29 | + */ | ||
30 | + @Test | ||
31 | + public void testImmutability() { | ||
32 | + assertThatClassIsImmutable(MplsPathIntent.class); | ||
33 | + } | ||
34 | + | ||
35 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.intent; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | + | ||
20 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | + | ||
22 | +/** | ||
23 | + * Unit tests for the OpticalConnectivityIntent class. | ||
24 | + */ | ||
25 | +public class OpticalConnectivityIntentTest { | ||
26 | + | ||
27 | + /** | ||
28 | + * Checks that the HostToHostIntent class is immutable. | ||
29 | + */ | ||
30 | + @Test | ||
31 | + public void testImmutability() { | ||
32 | + assertThatClassIsImmutable(OpticalConnectivityIntent.class); | ||
33 | + } | ||
34 | + | ||
35 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.intent; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | + | ||
20 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | + | ||
22 | +public class OpticalPathIntentTest { | ||
23 | + | ||
24 | + /** | ||
25 | + * Checks that the OpticalPathIntent class is immutable. | ||
26 | + */ | ||
27 | + @Test | ||
28 | + public void testImmutability() { | ||
29 | + assertThatClassIsImmutable(OpticalPathIntent.class); | ||
30 | + } | ||
31 | + | ||
32 | +} |
... | @@ -18,12 +18,21 @@ package org.onosproject.net.intent; | ... | @@ -18,12 +18,21 @@ package org.onosproject.net.intent; |
18 | import org.junit.Test; | 18 | import org.junit.Test; |
19 | 19 | ||
20 | import static org.junit.Assert.assertEquals; | 20 | import static org.junit.Assert.assertEquals; |
21 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Suite of tests of the single-to-multi point intent descriptor. | 24 | * Suite of tests of the single-to-multi point intent descriptor. |
24 | */ | 25 | */ |
25 | public class SinglePointToMultiPointIntentTest extends ConnectivityIntentTest { | 26 | public class SinglePointToMultiPointIntentTest extends ConnectivityIntentTest { |
26 | 27 | ||
28 | + /** | ||
29 | + * Checks that the SinglePointToMultiPointIntent class is immutable. | ||
30 | + */ | ||
31 | + @Test | ||
32 | + public void testImmutability() { | ||
33 | + assertThatClassIsImmutable(SinglePointToMultiPointIntent.class); | ||
34 | + } | ||
35 | + | ||
27 | @Test | 36 | @Test |
28 | public void basics() { | 37 | public void basics() { |
29 | SinglePointToMultiPointIntent intent = createOne(); | 38 | SinglePointToMultiPointIntent intent = createOne(); | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.intent; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | + | ||
20 | +import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | ||
21 | + | ||
22 | +/** | ||
23 | + * Unit tests for the TwoWayP2PIntent class. | ||
24 | + */ | ||
25 | +public class TwoWayP2PIntentTest { | ||
26 | + | ||
27 | + /** | ||
28 | + * Checks that the TwoWayP2PIntent class is immutable. | ||
29 | + */ | ||
30 | + @Test | ||
31 | + public void testImmutability() { | ||
32 | + assertThatClassIsImmutable(TwoWayP2PIntent.class); | ||
33 | + } | ||
34 | + | ||
35 | +} |
-
Please register or login to post a comment