TP-123 | hotfix FE changes (#47)

* TP-123 | hotfix FE changes

* TP-123 | start experiment with running state

* TP-123 | fix tests
This commit is contained in:
Akshat Soni
2023-03-30 14:42:47 +05:30
committed by GitHub Enterprise
parent 3c8f0dd9e3
commit c579e3ec67
6 changed files with 14 additions and 6 deletions

View File

@@ -100,7 +100,7 @@ public class ExperimentServiceImpl implements ExperimentService {
.experiment(experiment)
.experimentMetadata(experimentMetadata)
.testUsers(0L)
.experimentStatus(ExperimentStatus.CREATED)
.experimentStatus(ExperimentStatus.RUNNING)
.team(team.orElse(null))
.build();
experimentInfoQuery.save(experimentInfo);

View File

@@ -29,6 +29,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -133,6 +134,7 @@ public class SegmentServiceImpl implements SegmentService {
}
@Override
@Transactional
public SegmentResponse createSegment(CreateSegmentRequest request, String emailId) {
segmentValidator.validateCreateSegmentRequest(request);
String destinationBucketName = UUID.randomUUID().toString();

View File

@@ -44,11 +44,17 @@ public class TeamServiceImpl implements TeamService {
@Override
public List<Dropdown> getTeamsDropdown() {
List<TeamEntity> teamEntities = teamQuery.findAll();
return teamEntities.stream()
List<Dropdown> teamDropdown = teamEntities.stream()
.map(team -> Dropdown.builder()
.label(team.getTeamName())
.value(team.getTeamName())
.build())
.collect(Collectors.toList());
Dropdown allDropdown = Dropdown.builder()
.label("All")
.value("ALL")
.build();
teamDropdown.add(0, allDropdown);
return teamDropdown;
}
}

View File

@@ -30,7 +30,7 @@ public class MetricSpecification {
predicateList.add(
cb.equal(
root.get("metricType"),
String.valueOf(value)
value
)
);
});

View File

@@ -55,7 +55,7 @@ class TeamServiceImplTest {
TeamEntity team = TestUtils.getTeamEntity();
Mockito.when(teamQuery.findAll()).thenReturn(List.of(team));
List<Dropdown> dropdowns = teamService.getTeamsDropdown();
assertEquals("test team", dropdowns.get(0).getValue());
assertEquals("test team", dropdowns.get(0).getLabel());
assertEquals("test team", dropdowns.get(1).getValue());
assertEquals("test team", dropdowns.get(1).getLabel());
}
}

View File

@@ -44,7 +44,7 @@ class MetricSpecificationTest {
Mockito.when(metricEntityRootMock.get(any(String.class))).thenReturn(mockPath);
Mockito.when(criteriaBuilderMock.lower(mockPath)).thenReturn(mockExpression);
Mockito.when(criteriaBuilderMock.like(mockExpression, "%" + request.getQuery() + "%")).thenReturn(mockPredicate);
Mockito.when(criteriaBuilderMock.equal(mockPath, String.valueOf(request.getType()))).thenReturn(mockPredicate);
Mockito.when(criteriaBuilderMock.equal(mockPath, request.getType())).thenReturn(mockPredicate);
Mockito.when(criteriaBuilderMock.desc(mockPath)).thenReturn(mockOrder);
Mockito.when(criteriaQueryMock.orderBy(mockOrder)).thenReturn(criteriaQueryMock);
Mockito.when(criteriaBuilderMock.and(any())).thenReturn(mockPredicate);