@Test
  public void testDeserialize_basic() throws Exception {
    AddServiceRequest request = mapper.readValue(REQUEST_ALL_FIELDS_SET, AddServiceRequest.class);

    assertEquals(ADD_SERVICE, request.getOperationType());
    assertEquals(ALWAYS_APPLY, request.getRecommendationStrategy());
    assertEquals(INSTALL_ONLY, request.getProvisionAction());
    assertEquals(PERMISSIVE, request.getValidationType());
    assertEquals("HDP", request.getStackName());
    assertEquals("3.0", request.getStackVersion());

    Configuration configuration = request.getConfiguration();
    assertEquals(
      ImmutableMap.of("storm-site", ImmutableMap.of("final", ImmutableMap.of("fs.defaultFS", "true"))),
      configuration.getAttributes());
    assertEquals(
      ImmutableMap.of("storm-site", ImmutableMap.of("ipc.client.connect.max.retries", "50")),
      configuration.getProperties());

    assertEquals(
      ImmutableSet.of(
        Component.of("NIMBUS", START_ONLY, "c7401.ambari.apache.org", "c7402.ambari.apache.org"),
        Component.of("BEACON_SERVER", "c7402.ambari.apache.org", "c7403.ambari.apache.org")
      ),
      request.getComponents());

    assertEquals(
      ImmutableSet.of(Service.of("STORM", INSTALL_AND_START), Service.of("BEACON")),
      request.getServices());

    assertEquals(
      Optional.of(SecurityConfiguration.forTest(SecurityType.KERBEROS, "ref_to_kerb_desc", KERBEROS_DESCRIPTOR1)),
      request.getSecurity());

    assertEquals(
      ImmutableMap.of(
        "kdc.admin.credential", new Credential( "kdc.admin.credential", "admin/admin@EXAMPLE.COM", "k", CredentialStoreType.TEMPORARY)
      ),
      request.getCredentials()
    );
  }
Tests for {@link AddServiceRequest} serialization / deserialization / syntax validation
ambari-server/src/test/java/org/apache/ambari/server/topology/addservice/AddServiceRequestTest.java