Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5b48e80
Adding team mate's first name
DoolyEvgesha Oct 12, 2021
39098ea
Added my name to team
Oct 12, 2021
1c2228e
Adding team mate's first name
DoolyEvgesha Oct 13, 2021
85b474f
Change source and target version for maven
DoolyEvgesha Oct 13, 2021
d1767f4
Added methods in Logger to pass the tests (for Char, String, Boolean …
Oct 14, 2021
4070639
Refactor Logger
Oct 14, 2021
2f83ae2
Implement correct loggers for tests
DoolyEvgesha Oct 17, 2021
f1d95b7
Refactor Logger
Oct 18, 2021
ad61e3e
add typeChar + Ignore some tests in third iteration
DoolyEvgesha Oct 18, 2021
dfa5473
Merge remote-tracking branch 'origin/master'
DoolyEvgesha Oct 18, 2021
54a70e5
add new logging methods
DoolyEvgesha Oct 18, 2021
c384ac6
3rd iteration tests
DoolyEvgesha Oct 18, 2021
2fcfb1e
Refactor Logger
Oct 20, 2021
6068047
refactor in order to have DI and IoC
DoolyEvgesha Oct 20, 2021
98df284
refactor in order to have DI and IoC
DoolyEvgesha Oct 20, 2021
1ca698e
Refactor Logger
Oct 21, 2021
e5043d8
Refactor Logger
Oct 21, 2021
ed51370
Refactor Logger (added controllers)
Oct 21, 2021
ece1c6b
new JUnit test for ArrayList
DoolyEvgesha Oct 22, 2021
7e94f8c
Refactor Logger
Oct 25, 2021
d853d39
Refactor Logger
Oct 25, 2021
a187c0c
start JUnit integration testing services
DoolyEvgesha Oct 25, 2021
e5de23e
Add SimpleLoggerTest
Oct 25, 2021
3ea21ff
add test for Controller
DoolyEvgesha Oct 25, 2021
f7c4b02
Merge remote-tracking branch 'origin/master'
DoolyEvgesha Oct 25, 2021
2468de4
add test for Controller
DoolyEvgesha Oct 25, 2021
35e573b
Added tests for SimpleLogger and ComplexLogger
Oct 25, 2021
6514a1a
add test for Controller and run clean-up
DoolyEvgesha Oct 25, 2021
a7ad1ca
add some pom changes plus clean-up code
DoolyEvgesha Oct 26, 2021
4c111c8
create server and client proxies
DoolyEvgesha Oct 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Team of Oparina Darya

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use header

## and Ilinykh Uliana
# Java Junior Developer Training Course.
88 hours training + 32 hours work project = 120 hr.

---

# Introduction to Java and Java Technology (*1* hour theory / *including 0.5* hour practice)
- Introduction to Java. Benefits.
Expand Down
102 changes: 94 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,111 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.7.2</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.15</version>
</dependency>
</dependencies>
<configuration>
<targetClasses>
<param>com.acme.edu.*</param>
</targetClasses>
<targetTests>
<param>integration.*</param>
</targetTests>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<id>mutation-coverage</id>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
<execution>
<id>mutation-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.21.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>


</dependencies>
</project>
74 changes: 74 additions & 0 deletions src/main/java/com/acme/edu/Controller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.acme.edu;

import com.acme.edu.message.*;

import java.util.Objects;

import static com.acme.edu.TypeCodeEnum.NONE;

public class Controller {
private final StatesDTO statesDTO;
private final Flusher flusher;

public Controller(StatesDTO statesDTO) {
this.statesDTO = statesDTO;
this.flusher = new Flusher();
}

public Controller(StatesDTO statesDTO, Flusher flusher) {
this.statesDTO = statesDTO;
this.flusher = flusher;
}

public void log(Message message) {
TypeCodeEnum typeCodeEnum = message.getCode();

if (statesDTO.getPrevTypeCodeEnum() != NONE && typeCodeEnum != statesDTO.getPrevTypeCodeEnum()) {
flusher.flush(statesDTO);
}

switch (typeCodeEnum) {
case BOOLEAN: {
statesDTO.setPrevBoolean((BooleanMessage) message);
break;
}
case CHAR: {
statesDTO.setPrevChar((CharMessage) message);
break;
}
case STRING: {
stringIteration((StringMessage) message);
break;
}
case BYTE: {
statesDTO.setByteSum((ByteMessage) message);
break;
}
case INTEGER: {
statesDTO.setIntegerSum((IntMessage) message);
break;
}
case ARRAY_INT: {
statesDTO.arrayIncrementer((ArrayMessage) message);
break;
}
case MATRIX_INT: {
statesDTO.matrixIncrementer((MatrixMessage) message);
break;
}
default: {
flusher.flush(typeCodeEnum.getTypeReference() + message);
}
}
statesDTO.setPrevTypeCodeEnum(typeCodeEnum);
}

private void stringIteration(StringMessage message) {
if (Objects.equals(statesDTO.getPrevString(), message.getMessage())) {
statesDTO.incSimilarStringCounter();
} else if (statesDTO.getPrevString() != null) {
flusher.flush(statesDTO);
}
statesDTO.setPrevString(message.getMessage());
}
}
71 changes: 71 additions & 0 deletions src/main/java/com/acme/edu/Flusher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.acme.edu;

import com.acme.edu.saver.Saver;
import com.acme.edu.saver.SystemOutSaver;

public class Flusher {

private final Saver saver;

public Flusher() {
this.saver = new SystemOutSaver();
}

public Flusher(Saver saver) {
this.saver = saver;
}

public void flush(String message) {
saver.save(message);
}

public void flush(StatesDTO statesDTO) {
switch (statesDTO.getPrevTypeCodeEnum()) {
case BOOLEAN: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getPrevBoolean());
break;
}
case CHAR: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getPrevChar());
break;
}
case STRING: {
stringCase(statesDTO);
break;
}
case BYTE: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getByteSum());
statesDTO.clearByteSum();
break;
}
case INTEGER: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getIntegerSum());
statesDTO.clearIntegerSum();
break;
}
case ARRAY_INT: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getArrayIntSum());
statesDTO.clearArrayIntSum();
break;
}
case MATRIX_INT: {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getMatrixIntSum());
statesDTO.clearMatrixIntSum();
break;
}
default:
break;
}
}

private void stringCase(StatesDTO statesDTO) {
statesDTO.incSimilarStringCounter();
if (statesDTO.getSimilarStringCounter() > 1) {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getPrevString() + " (x" + statesDTO.getSimilarStringCounter() + ")");
} else {
saver.save(statesDTO.getPrevTypeCodeEnum().getTypeReference() + statesDTO.getPrevString());
}
statesDTO.setPrevString(null);
statesDTO.clearSimilarStringCounter();
}
}
11 changes: 0 additions & 11 deletions src/main/java/com/acme/edu/Logger.java

This file was deleted.

Loading