Skip to content

Commit

Permalink
Testler düzenlendi ve yeni senaryolar eklendi.
Browse files Browse the repository at this point in the history
  • Loading branch information
Murat0zer committed Oct 29, 2018
1 parent 095e596 commit 4819bbe
Show file tree
Hide file tree
Showing 83 changed files with 282 additions and 714 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ log/
upload/
.git
application-*.properties
sonar-project.properties
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>LATEST</version>
<version>1.18.2</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ListCommentsRoute(CommentMessageProvider commentMessageProvider,
@ApiImplicitParam(required = true, dataType = "string", name = "sessionId", paramType = "path"), //
@ApiImplicitParam(required = true, dataType = "string", name = "userId", paramType = "path"), //
@ApiImplicitParam(required = true, dataType = "string", name = "status", paramType = "path", example = "denied, pending, approved"), //
@ApiImplicitParam(dataType = "int", name = "count", paramType = "query"), //
@ApiImplicitParam(dataType = "int", name = "voteCount", paramType = "query"), //
@ApiImplicitParam(dataType = "string", name = "type", paramType = "query", example = "top-rated, recent, oldest"), //
@ApiImplicitParam(dataType = "int", name = "page", paramType = "query", example = "1,2,5,10,100"), //
@ApiImplicitParam(dataType = "string", name = "clientType", paramType = "query", example = "web"), //
Expand All @@ -68,7 +68,7 @@ public ResponseMessage handle(@ApiParam(hidden = true) Request request, @ApiPara

String status = request.params("status");

String count = request.queryParams("count");
String count = request.queryParams("voteCount");
String type = request.queryParams("type");
String page = request.queryParams("page");
String clientType = request.queryParams("clientType");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class PasswordEncryptionService {
// specifically names SHA-1 as an acceptable hashing algorithm for PBKDF2
private static final String ALGORITHM = "PBKDF2WithHmacSHA1";

// Pick an iteration count that works for you. The NIST recommends at
// Pick an iteration voteCount that works for you. The NIST recommends at
// least 1,000 iterations:
// http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf
// iOS 4.x reportedly uses 10,000:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public static ResponseMessage isEventCompatibleWithState(Event eventFromDB, Even
}

if (!isRoomCountValid(newEvent.getRooms(), baseEventState.getRoomCount())) {
return new ResponseMessage(false, "Room count must be equal or below at " + baseEventState.getRoomCount(), "");
return new ResponseMessage(false, "Room voteCount must be equal or below at " + baseEventState.getRoomCount(), "");
}

if (!isSessionCountValid(newEvent.getAgenda(), baseEventState.getSessionCount())) {
return new ResponseMessage(false, "Session count must be equal or below at " + baseEventState.getSessionCount(), "");
return new ResponseMessage(false, "Session voteCount must be equal or below at " + baseEventState.getSessionCount(), "");
}

if (!isParticipiantCountValid(newEvent.getTotalUsers(), baseEventState.getParticipantCount())) {
return new ResponseMessage(false, "Participiant count must be equal or below at " + baseEventState.getParticipantCount(), "");
return new ResponseMessage(false, "Participiant voteCount must be equal or below at " + baseEventState.getParticipantCount(), "");
}

return new ResponseMessage(true, "Event state is valid", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class EventSessionStatisticsDTO {
private String speaker;
private String workingAt;
private String topic;
private String count;
private String voteCount;
private String average;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import javaday.istanbul.sliconf.micro.model.event.Speaker;
import javaday.istanbul.sliconf.micro.model.event.agenda.AgendaElement;
import javaday.istanbul.sliconf.micro.model.response.ResponseMessage;
import javaday.istanbul.sliconf.micro.service.event.EventRepositoryService;
import javaday.istanbul.sliconf.micro.survey.service.GeneralService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -16,25 +15,24 @@
@Service
public class StatisticsService {

private final EventRepositoryService eventRepositoryService;

private final GeneralService generalService;


ResponseMessage getEventSessionsStatistics(String eventKey) {
public ResponseMessage getEventSessionsStatistics(String eventKey) {

Event event = (Event) generalService.findEventByIdOrEventKey(eventKey).getReturnObject();
List<AgendaElement> agendaElements = new ArrayList<>(event.getAgenda());
List<Speaker> speakers = new ArrayList<>(event.getSpeakers());
List<EventSessionStatisticsDTO> eventSessionStatisticsDTOList = new ArrayList<>();

agendaElements.forEach(agendaElement -> speakers.forEach(speaker -> {

if (agendaElement.getSpeaker().equals(speaker.getId())) {

EventSessionStatisticsDTO eventSessionStatisticsDTO = new EventSessionStatisticsDTO();
eventSessionStatisticsDTO.setPhoto(speaker.getProfilePicture());
String average = String.valueOf(agendaElement.getStar());
eventSessionStatisticsDTO.setAverage(average);
eventSessionStatisticsDTO.setCount(String.valueOf(agendaElement.getVoteCount()));
eventSessionStatisticsDTO.setVoteCount(String.valueOf(agendaElement.getVoteCount()));
eventSessionStatisticsDTO.setTopic(agendaElement.getTopic());
eventSessionStatisticsDTO.setWorkingAt(speaker.getWorkingAt());
eventSessionStatisticsDTO.setSpeaker(speaker.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
plugin = "pretty",
snippets = SnippetType.CAMELCASE,
strict = true,
tags = {"@Anket"})
tags = {})
@ActiveProfiles("test")
public class RunCukesTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package javaday.istanbul.sliconf.micro;

import lombok.extern.slf4j.Slf4j;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

@Slf4j
@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
public abstract class SpringBootTestConfig {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package javaday.istanbul.sliconf.micro.steps.admin;

import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

@Ignore
public class AdminGetUserInfoTest extends SpringBootTestConfig {

@Test
public void getUserInfo() {
assertTrue(true);
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
package javaday.istanbul.sliconf.micro.steps.admin;

import cucumber.api.java.tr.Diyelimki;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.controller.admin.AdminListEventsRoute;
import javaday.istanbul.sliconf.micro.model.User;
import javaday.istanbul.sliconf.micro.model.response.ResponseMessage;
import javaday.istanbul.sliconf.micro.security.TokenAuthenticationService;
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import javaday.istanbul.sliconf.micro.util.Constants;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.Authentication;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import static org.junit.Assert.*;

@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class AdminListEventsTest {// NOSONAR
@Ignore
public class AdminListEventsTest extends SpringBootTestConfig { // NOSONAR

@Autowired
private UserRepositoryService userRepositoryService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
package javaday.istanbul.sliconf.micro.steps.admin;

import cucumber.api.java.tr.Diyelimki;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.controller.admin.AdminListUsersRoute;
import javaday.istanbul.sliconf.micro.model.User;
import javaday.istanbul.sliconf.micro.model.response.ResponseMessage;
import javaday.istanbul.sliconf.micro.security.TokenAuthenticationService;
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import javaday.istanbul.sliconf.micro.util.Constants;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.Authentication;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import static org.junit.Assert.*;

@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class AdminListUsersTest {// NOSONAR
@Ignore
public class AdminListUsersTest extends SpringBootTestConfig { // NOSONAR

@Autowired
private UserRepositoryService userRepositoryService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
package javaday.istanbul.sliconf.micro.steps;
package javaday.istanbul.sliconf.micro.steps.other;


import com.couchbase.client.java.document.json.JsonObject;
import cucumber.api.java.Before;
import cucumber.api.java.tr.Diyelimki;
import cucumber.api.java.tr.Eğerki;
import cucumber.api.java.tr.Ozaman;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.builder.UserBuilder;
import javaday.istanbul.sliconf.micro.model.User;
import javaday.istanbul.sliconf.micro.model.response.ResponseMessage;
import javaday.istanbul.sliconf.micro.service.UserPassService;
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
import org.junit.Ignore;

import static javaday.istanbul.sliconf.micro.specs.UserSpecs.checkUserParams;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class A265 {
@Ignore
public class A265 extends SpringBootTestConfig {
private User user;
private User dbUser;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package javaday.istanbul.sliconf.micro.steps;
package javaday.istanbul.sliconf.micro.steps.other;

import cucumber.api.java.tr.Diyelimki;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.builder.EventBuilder;
import javaday.istanbul.sliconf.micro.controller.event.comment.AddNewCommentRoute;
import javaday.istanbul.sliconf.micro.model.User;
Expand All @@ -13,12 +13,8 @@
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import javaday.istanbul.sliconf.micro.specs.EventSpecs;
import javaday.istanbul.sliconf.micro.util.TestUtil;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -27,13 +23,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class AddNewCommentTest {// NOSONAR
@Ignore
public class AddNewCommentTest extends SpringBootTestConfig { // NOSONAR

@Autowired
UserRepositoryService userRepositoryService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package javaday.istanbul.sliconf.micro.steps;
package javaday.istanbul.sliconf.micro.steps.other;


import cucumber.api.java.tr.Diyelimki;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.builder.EventBuilder;
import javaday.istanbul.sliconf.micro.controller.event.speaker.CreateSpeakerRoute;
import javaday.istanbul.sliconf.micro.model.User;
Expand All @@ -16,12 +16,8 @@
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import javaday.istanbul.sliconf.micro.specs.EventSpecs;
import javaday.istanbul.sliconf.micro.util.TestUtil;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -30,13 +26,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class AddSpeakerTest {// NOSONAR
@Ignore
public class AddSpeakerTest extends SpringBootTestConfig { // NOSONAR


@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
package javaday.istanbul.sliconf.micro.steps;
package javaday.istanbul.sliconf.micro.steps.other;

import cucumber.api.java.Before;
import cucumber.api.java.tr.Diyelimki;
import cucumber.api.java.tr.Eğerki;
import cucumber.api.java.tr.Ozaman;
import javaday.istanbul.sliconf.micro.CucumberConfiguration;
import javaday.istanbul.sliconf.micro.SpringBootTestConfig;
import javaday.istanbul.sliconf.micro.builder.UserBuilder;
import javaday.istanbul.sliconf.micro.model.User;
import javaday.istanbul.sliconf.micro.model.event.Event;
import javaday.istanbul.sliconf.micro.service.UserPassService;
import javaday.istanbul.sliconf.micro.service.event.EventRepositoryService;
import javaday.istanbul.sliconf.micro.service.user.UserRepositoryService;
import org.junit.Ignore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@ContextConfiguration(classes = {CucumberConfiguration.class})
@WebAppConfiguration
@AutoConfigureMockMvc
@SpringBootTest
@ActiveProfiles("test")
public class B768 {
@Ignore
public class B768 extends SpringBootTestConfig {

private User user;
private User dbUser;
Expand Down
Loading

0 comments on commit 4819bbe

Please sign in to comment.