Search in sources :

Example 1 with GetAllUserRatingStabilitiesRequest

use of org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest in project haikudepotserver by haiku.

the class MiscelaneousApiIT method testGetAllUserRatingStabilities.

@Test
public void testGetAllUserRatingStabilities() {
    // ------------------------------------
    GetAllUserRatingStabilitiesResult result = miscellaneousApi.getAllUserRatingStabilities(new GetAllUserRatingStabilitiesRequest());
    // ------------------------------------
    ObjectContext objectContext = serverRuntime.newContext();
    List<UserRatingStability> userRatingStabilities = UserRatingStability.getAll(objectContext);
    Assertions.assertThat(userRatingStabilities.size()).isEqualTo(result.userRatingStabilities.size());
    for (int i = 0; i < userRatingStabilities.size(); i++) {
        UserRatingStability userRatingStability = userRatingStabilities.get(i);
        GetAllUserRatingStabilitiesResult.UserRatingStability apiUserRatingStability = result.userRatingStabilities.get(i);
        Assertions.assertThat(userRatingStability.getCode()).isEqualTo(apiUserRatingStability.code);
        Assertions.assertThat(userRatingStability.getName()).isEqualTo(apiUserRatingStability.name);
    }
}
Also used : GetAllUserRatingStabilitiesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesResult) GetAllUserRatingStabilitiesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest) ObjectContext(org.apache.cayenne.ObjectContext) UserRatingStability(org.haiku.haikudepotserver.dataobjects.UserRatingStability) AbstractIntegrationTest(org.haiku.haikudepotserver.AbstractIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with GetAllUserRatingStabilitiesRequest

use of org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest in project haikudepotserver by haiku.

the class MiscelaneousApiIT method testGetAllUserRatingStabilities_de.

@Test
public void testGetAllUserRatingStabilities_de() {
    GetAllUserRatingStabilitiesRequest request = new GetAllUserRatingStabilitiesRequest();
    request.naturalLanguageCode = NaturalLanguage.CODE_GERMAN;
    // ------------------------------------
    GetAllUserRatingStabilitiesResult result = miscellaneousApi.getAllUserRatingStabilities(request);
    // ------------------------------------
    Optional<GetAllUserRatingStabilitiesResult.UserRatingStability> userRatingStabilityOptional = result.userRatingStabilities.stream().filter(urs -> urs.code.equals("mostlystable")).findFirst();
    Assertions.assertThat(userRatingStabilityOptional.isPresent()).isTrue();
    Assertions.assertThat(userRatingStabilityOptional.get().name).isEqualTo("Ziemlich stabil");
}
Also used : GetAllNaturalLanguagesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllNaturalLanguagesResult) ObjectContext(org.apache.cayenne.ObjectContext) URL(java.net.URL) AbstractIntegrationTest(org.haiku.haikudepotserver.AbstractIntegrationTest) PkgCategory(org.haiku.haikudepotserver.dataobjects.PkgCategory) IntegrationTestSupportService(org.haiku.haikudepotserver.IntegrationTestSupportService) GetAllArchitecturesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllArchitecturesRequest) GetAllUserRatingStabilitiesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) GetAllPkgCategoriesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllPkgCategoriesRequest) GetAllMessagesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllMessagesRequest) GetAllUserRatingStabilitiesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesResult) Splitter(com.google.common.base.Splitter) TestConfig(org.haiku.haikudepotserver.config.TestConfig) GetAllMessagesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllMessagesResult) GetAllNaturalLanguagesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllNaturalLanguagesRequest) GetAllArchitecturesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllArchitecturesResult) UserRatingStability(org.haiku.haikudepotserver.dataobjects.UserRatingStability) MalformedURLException(java.net.MalformedURLException) Assertions(org.fest.assertions.Assertions) NaturalLanguage(org.haiku.haikudepotserver.dataobjects.NaturalLanguage) Resource(javax.annotation.Resource) RuntimeInformationService(org.haiku.haikudepotserver.support.RuntimeInformationService) Test(org.junit.jupiter.api.Test) List(java.util.List) GetRuntimeInformationResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetRuntimeInformationResult) GetRuntimeInformationRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetRuntimeInformationRequest) GenerateFeedUrlRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GenerateFeedUrlRequest) ContextConfiguration(org.springframework.test.context.ContextConfiguration) Optional(java.util.Optional) FeedService(org.haiku.haikudepotserver.feed.model.FeedService) GetAllPkgCategoriesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllPkgCategoriesResult) GetAllUserRatingStabilitiesRequest(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest) GetAllUserRatingStabilitiesResult(org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesResult) UserRatingStability(org.haiku.haikudepotserver.dataobjects.UserRatingStability) AbstractIntegrationTest(org.haiku.haikudepotserver.AbstractIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectContext (org.apache.cayenne.ObjectContext)2 AbstractIntegrationTest (org.haiku.haikudepotserver.AbstractIntegrationTest)2 GetAllUserRatingStabilitiesRequest (org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest)2 GetAllUserRatingStabilitiesResult (org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesResult)2 UserRatingStability (org.haiku.haikudepotserver.dataobjects.UserRatingStability)2 Test (org.junit.jupiter.api.Test)2 Splitter (com.google.common.base.Splitter)1 ImmutableList (com.google.common.collect.ImmutableList)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Resource (javax.annotation.Resource)1 Assertions (org.fest.assertions.Assertions)1 IntegrationTestSupportService (org.haiku.haikudepotserver.IntegrationTestSupportService)1 GenerateFeedUrlRequest (org.haiku.haikudepotserver.api1.model.miscellaneous.GenerateFeedUrlRequest)1 GetAllArchitecturesRequest (org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllArchitecturesRequest)1 GetAllArchitecturesResult (org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllArchitecturesResult)1 GetAllMessagesRequest (org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllMessagesRequest)1