Skip to content

Commit 808c6df

Browse files
Antonio Forniespark404
authored andcommitted
Fix and add some Rest unit and IT tests. Fix by adding a missing type of RoutingConfig.
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
1 parent b70af44 commit 808c6df

4 files changed

Lines changed: 263 additions & 210 deletions

File tree

plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,9 @@ public NatRule deserialize(final JsonElement jsonElement, final Type type, final
634634

635635
public static class RoutingConfigAdapter implements JsonDeserializer<RoutingConfig> {
636636

637+
private static final String ROUTING_TABLE_ROUTING_CONFIG = "RoutingTableRoutingConfig";
638+
private static final String SINGLE_DEFAULT_ROUTE_IMPLICIT_ROUTING_CONFIG = "SingleDefaultRouteImplicitRoutingConfig";
639+
637640
@Override
638641
public RoutingConfig deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext context) throws JsonParseException {
639642
final JsonObject jsonObject = jsonElement.getAsJsonObject();
@@ -643,8 +646,10 @@ public RoutingConfig deserialize(final JsonElement jsonElement, final Type type,
643646
}
644647

645648
final String routingConfigType = jsonObject.get("type").getAsString();
646-
if ("SingleDefaultRouteImplicitRoutingConfig".equals(routingConfigType)) {
649+
if (SINGLE_DEFAULT_ROUTE_IMPLICIT_ROUTING_CONFIG.equals(routingConfigType)) {
647650
return context.deserialize(jsonElement, SingleDefaultRouteImplicitRoutingConfig.class);
651+
} else if (ROUTING_TABLE_ROUTING_CONFIG.equals(routingConfigType)) {
652+
return context.deserialize(jsonElement, RoutingTableRoutingConfig.class);
648653
}
649654

650655
throw new JsonParseException("Failed to deserialize type \"" + routingConfigType + "\"");
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
//
19+
20+
package com.cloud.network.nicira;
21+
22+
/**
23+
*
24+
*/
25+
public class RoutingTableRoutingConfig extends RoutingConfig {
26+
public final String type = "RoutingTableRoutingConfig";
27+
28+
public RoutingTableRoutingConfig() {
29+
}
30+
}

0 commit comments

Comments
 (0)