Search in sources :

Example 6 with RegistrationSummary

use of org.wso2.carbon.apimgt.core.models.RegistrationSummary in project carbon-apimgt by wso2.

the class MappingUtil method toJWTInfoDTO.

/**
 * Converts RegistrationSummary JWT information into JWTInfoDTO
 *
 * @param registrationSummary the registration summary required by gateway
 * @return JWTInfoDTO
 */
private static JWTInfoDTO toJWTInfoDTO(RegistrationSummary registrationSummary) {
    JWTInfoDTO jwtInfoDTO = new JWTInfoDTO();
    jwtInfoDTO.enableJWTGeneration(registrationSummary.getJwtInfo().isEnableJWTGeneration());
    jwtInfoDTO.jwtHeader(registrationSummary.getJwtInfo().getJwtHeader());
    return jwtInfoDTO;
}
Also used : JWTInfoDTO(org.wso2.carbon.apimgt.rest.api.core.dto.JWTInfoDTO)

Example 7 with RegistrationSummary

use of org.wso2.carbon.apimgt.core.models.RegistrationSummary in project carbon-apimgt by wso2.

the class MappingUtil method toRegistrationSummaryDTO.

/**
 * Converts the Gateway registration summary into RegistrationSummaryDTO
 *
 * @param registrationSummary the registration summary required by gateway
 * @return RegistrationSummaryDTO
 */
public static RegistrationSummaryDTO toRegistrationSummaryDTO(RegistrationSummary registrationSummary) {
    RegistrationSummaryDTO registrationSummaryDTO = new RegistrationSummaryDTO();
    registrationSummaryDTO.setKeyManagerInfo(toKeyManagerInfoDTO(registrationSummary));
    registrationSummaryDTO.setAnalyticsInfo(toAnalyticsDTO(registrationSummary));
    registrationSummaryDTO.setJwTInfo(toJWTInfoDTO(registrationSummary));
    registrationSummaryDTO.setThrottlingInfo(toThrottlingInfoDTO(registrationSummary));
    registrationSummaryDTO.setGoogleAnalyticsTrackingInfo(toGoogleAnalyticsTrackingInfoDTO(registrationSummary.getGoogleAnalyticsTrackingInfo()));
    return registrationSummaryDTO;
}
Also used : RegistrationSummaryDTO(org.wso2.carbon.apimgt.rest.api.core.dto.RegistrationSummaryDTO)

Example 8 with RegistrationSummary

use of org.wso2.carbon.apimgt.core.models.RegistrationSummary in project carbon-apimgt by wso2.

the class MappingUtilTestCase method toRegistrationSummaryDTOTest.

@Test
public void toRegistrationSummaryDTOTest() {
    RegistrationSummary registrationSummary = SampleTestObjectCreator.createUniqueRegistrationSummary();
    RegistrationSummaryDTO registrationSummaryDTO = MappingUtil.toRegistrationSummaryDTO(registrationSummary);
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getCredentials().getPassword(), registrationSummaryDTO.getKeyManagerInfo().getCredentials().getPassword());
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getCredentials().getUsername(), registrationSummaryDTO.getKeyManagerInfo().getCredentials().getUsername());
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getDcrEndpoint(), registrationSummaryDTO.getKeyManagerInfo().getDcrEndpoint());
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getIntrospectEndpoint(), registrationSummaryDTO.getKeyManagerInfo().getIntrospectEndpoint());
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getRevokeEndpoint(), registrationSummaryDTO.getKeyManagerInfo().getRevokeEndpoint());
    Assert.assertEquals(registrationSummary.getKeyManagerInfo().getTokenEndpoint(), registrationSummaryDTO.getKeyManagerInfo().getTokenEndpoint());
    Assert.assertEquals(registrationSummary.getAnalyticsInfo().getDasServerCredentials().getUsername(), registrationSummaryDTO.getAnalyticsInfo().getCredentials().getUsername());
    Assert.assertEquals(registrationSummary.getAnalyticsInfo().getDasServerCredentials().getPassword(), registrationSummaryDTO.getAnalyticsInfo().getCredentials().getPassword());
    Assert.assertEquals(registrationSummary.getAnalyticsInfo().getDasServerURL(), registrationSummaryDTO.getAnalyticsInfo().getServerURL());
    Assert.assertEquals(Boolean.valueOf(registrationSummary.getAnalyticsInfo().isEnabled()), Boolean.valueOf(registrationSummaryDTO.getAnalyticsInfo().getEnabled()));
    Assert.assertEquals(registrationSummary.getJwtInfo().getJwtHeader(), registrationSummaryDTO.getJwTInfo().getJwtHeader());
    Assert.assertEquals(Boolean.valueOf(registrationSummary.getJwtInfo().isEnableJWTGeneration()), Boolean.valueOf(registrationSummaryDTO.getJwTInfo().getEnableJWTGeneration()));
    Assert.assertEquals(registrationSummary.getThrottlingInfo().getDataPublisher().getReceiverURL(), registrationSummaryDTO.getThrottlingInfo().getServerURL());
    Assert.assertEquals(registrationSummary.getThrottlingInfo().getDataPublisher().getCredentials().getPassword(), registrationSummaryDTO.getThrottlingInfo().getCredentials().getPassword());
    Assert.assertEquals(registrationSummary.getThrottlingInfo().getDataPublisher().getCredentials().getUsername(), registrationSummaryDTO.getThrottlingInfo().getCredentials().getUsername());
}
Also used : RegistrationSummaryDTO(org.wso2.carbon.apimgt.rest.api.core.dto.RegistrationSummaryDTO) RegistrationSummary(org.wso2.carbon.apimgt.core.models.RegistrationSummary) Test(org.testng.annotations.Test)

Aggregations

CredentialsDTO (org.wso2.carbon.apimgt.rest.api.core.dto.CredentialsDTO)4 RegistrationSummary (org.wso2.carbon.apimgt.core.models.RegistrationSummary)3 LabelInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.LabelInfoDTO)2 RegistrationSummaryDTO (org.wso2.carbon.apimgt.rest.api.core.dto.RegistrationSummaryDTO)2 HashMap (java.util.HashMap)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Test (org.testng.annotations.Test)1 APIMgtAdminService (org.wso2.carbon.apimgt.core.api.APIMgtAdminService)1 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)1 APIMgtResourceNotFoundException (org.wso2.carbon.apimgt.core.exception.APIMgtResourceNotFoundException)1 APIMgtAdminServiceImpl (org.wso2.carbon.apimgt.core.impl.APIMgtAdminServiceImpl)1 Label (org.wso2.carbon.apimgt.core.models.Label)1 AnalyticsInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.AnalyticsInfoDTO)1 JWTInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.JWTInfoDTO)1 KeyManagerInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.KeyManagerInfoDTO)1 RegistrationDTO (org.wso2.carbon.apimgt.rest.api.core.dto.RegistrationDTO)1 ThrottlingInfoDTO (org.wso2.carbon.apimgt.rest.api.core.dto.ThrottlingInfoDTO)1