Skip to content

Commit ad12fad

Browse files
committed
Add module sandbox-core extracted from repo: https://github.com/andrei-punko/java-sandbox
1 parent b540603 commit ad12fad

File tree

333 files changed

+13857
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+13857
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
.idea
3+
*.iml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
## Playground for preparation to Java interview

pom.xml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<artifactId>java-interview</artifactId>
9+
<groupId>by.andd3dfx</groupId>
10+
<version>1.0-SNAPSHOT</version>
11+
12+
<build>
13+
<plugins>
14+
<plugin>
15+
<groupId>org.jacoco</groupId>
16+
<artifactId>jacoco-maven-plugin</artifactId>
17+
<version>0.8.5</version>
18+
<executions>
19+
<execution>
20+
<goals>
21+
<goal>prepare-agent</goal>
22+
</goals>
23+
</execution>
24+
<execution>
25+
<id>report</id>
26+
<phase>prepare-package</phase>
27+
<goals>
28+
<goal>report</goal>
29+
</goals>
30+
</execution>
31+
</executions>
32+
</plugin>
33+
34+
<!--
35+
Starts an minimal embedded ActiveMQ broker for the test.
36+
-->
37+
<plugin>
38+
<groupId>org.apache.activemq.tooling</groupId>
39+
<artifactId>activemq-maven-plugin</artifactId>
40+
<version>${activemq.version}</version>
41+
<configuration>
42+
<configUri>xbean:file:${project.build.testOutputDirectory}/activemq.xml</configUri>
43+
<fork>true</fork>
44+
<systemProperties>
45+
<property>
46+
<name>org.apache.activemq.default.directory.prefix</name>
47+
<value>./target/</value>
48+
</property>
49+
</systemProperties>
50+
</configuration>
51+
<dependencies>
52+
<dependency>
53+
<groupId>org.apache.activemq</groupId>
54+
<artifactId>activemq-spring</artifactId>
55+
<version>${activemq.version}</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.apache.activemq</groupId>
59+
<artifactId>activemq-leveldb-store</artifactId>
60+
<version>${activemq.version}</version>
61+
</dependency>
62+
</dependencies>
63+
<executions>
64+
<execution>
65+
<id>start-activemq</id>
66+
<goals>
67+
<goal>run</goal>
68+
</goals>
69+
<phase>process-test-resources</phase>
70+
</execution>
71+
</executions>
72+
</plugin>
73+
</plugins>
74+
</build>
75+
76+
<dependencies>
77+
<dependency>
78+
<groupId>org.jsoup</groupId>
79+
<artifactId>jsoup</artifactId>
80+
<version>1.8.2</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.apache.activemq</groupId>
84+
<artifactId>activemq-broker</artifactId>
85+
<version>${activemq.version}</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.apache.logging.log4j</groupId>
89+
<artifactId>log4j-core</artifactId>
90+
<version>2.13.2</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.springframework.boot</groupId>
94+
<artifactId>spring-boot-starter-logging</artifactId>
95+
<version>1.5.8.RELEASE</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.apache.commons</groupId>
99+
<artifactId>commons-lang3</artifactId>
100+
</dependency>
101+
<dependency>
102+
<groupId>org.jasypt</groupId>
103+
<artifactId>jasypt</artifactId>
104+
<version>1.9.3</version>
105+
</dependency>
106+
107+
<!-- Staff for REST client. Selected versions are compatible for Java6u45 -->
108+
<dependency>
109+
<groupId>org.springframework</groupId>
110+
<artifactId>spring-web</artifactId>
111+
<version>4.1.6.RELEASE</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.apache.httpcomponents</groupId>
115+
<artifactId>httpclient</artifactId>
116+
<version>4.3.6</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.bouncycastle</groupId>
120+
<artifactId>bcprov-jdk15on</artifactId>
121+
<version>1.54</version>
122+
</dependency>
123+
<dependency>
124+
<groupId>com.fasterxml.jackson.core</groupId>
125+
<artifactId>jackson-databind</artifactId>
126+
<version>[2.9.9,)</version>
127+
</dependency>
128+
129+
<!-- Guice -->
130+
<dependency>
131+
<groupId>com.google.inject</groupId>
132+
<artifactId>guice</artifactId>
133+
<version>4.2.3</version>
134+
</dependency>
135+
136+
<dependency>
137+
<groupId>com.github.stefanbirkner</groupId>
138+
<artifactId>system-rules</artifactId>
139+
<version>1.17.0</version>
140+
<scope>test</scope>
141+
</dependency>
142+
143+
<dependency>
144+
<groupId>junit</groupId>
145+
<artifactId>junit</artifactId>
146+
<version>4.13.1</version>
147+
<scope>test</scope>
148+
</dependency>
149+
<dependency>
150+
<groupId>org.jmock</groupId>
151+
<artifactId>jmock-legacy</artifactId>
152+
<version>2.8.3</version>
153+
<scope>test</scope>
154+
</dependency>
155+
<dependency>
156+
<groupId>org.hamcrest</groupId>
157+
<artifactId>hamcrest-all</artifactId>
158+
<version>1.3</version>
159+
<scope>test</scope>
160+
</dependency>
161+
</dependencies>
162+
163+
<properties>
164+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
165+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
166+
167+
<maven.compiler.source>1.8</maven.compiler.source>
168+
<maven.compiler.target>1.8</maven.compiler.target>
169+
170+
<lombok.version>1.18.10</lombok.version>
171+
<commons-lang.version>3.8.1</commons-lang.version>
172+
173+
<activemq.version>5.14.5</activemq.version>
174+
</properties>
175+
176+
<dependencyManagement>
177+
<dependencies>
178+
<dependency>
179+
<groupId>org.projectlombok</groupId>
180+
<artifactId>lombok</artifactId>
181+
<version>${lombok.version}</version>
182+
</dependency>
183+
<dependency>
184+
<groupId>org.apache.commons</groupId>
185+
<artifactId>commons-lang3</artifactId>
186+
<version>${commons-lang.version}</version>
187+
</dependency>
188+
</dependencies>
189+
</dependencyManagement>
190+
</project>

sandbox/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{Java=193, SQL=57, Spring Framework=57, Git=51, JavaScript=50, ���������� ����=45, Linux=36, Hibernate ORM=35, Python=35, Android=34, MySQL=32, CSS=25, ���=23, HTML=23, REST=23, PostgreSQL=18, Java EE=17, Java SE=17, Kotlin=17, Android SDK=16, AngularJS=15, Atlassian Jira=15, iOS=13, C#=12, MongoDB=12, C++=12, PHP=12, ORACLE=12, AWS=12, SCALA=11, HTML5=11, Docker=10, JUnit=10, Big Data=10, MS SQL=8, Node.js=8, QA=8, Apache Maven=8, XML=8, NoSQL=7, HTTP=7, Redis=7, React=7, Objective-C=7, jQuery=7, Agile Project Management=6, Oracle Pl/SQL=6, Ruby=6, SVN=6, Apache Tomcat=6, Kafka=6, JSP=5, ������������=5, ������ � �������=5, ASP.NET=5, Golang=5, Spark=5, CSS3=5, Selenium IDE=5, Gradle=5, Delphi=4, Jenkins=4, REST API=4, JSON API=4, Scrum=4, Yii=4, SOAP=4, Databases=4, Symfony=3, Test case=3, CMS Wordpress=3, Google Cloud=3, UML=3, Business Development=3, Business English=3, .NET Framework=3, ETL=3, Less=3, Angular=3, ��������� ����=3, English=3, �������������� ������������=3, Ajax=3, Cassandra=3, Laravel=3, Bootstrap=3, Ext JS=3, Vue.js=3, DevOps=3, JPA=3, MVC=3, React.js=2, ����=2, ���������� ��=2, Intellij IDEA=2, Customer Service=2, ����������������� �������� Linux=2, Project management=2, Entity Framework=2, Spring MVC=2, Ruby On Rails=2, Sales Planning=2, Automation testing=2, JSON=2, TestNG=2, Maven=2, Go=2, testing=2, Swift=2, vue.js=2, Android Studio=2, Vue=2, Sass=2, ReactJS=2, ��������=2, Vaadin=2, Selenium=2, Hibernate=2, Azure=2, ������ ���������=2, ������c������ ������������=2, TypeScript=2, VueJS=2, Analytical skills=2, ���-����������������=2, PHP5=2, API=2, PHP7=2, SQLite=2, POS=2, Redux=2, .Net=2, Django Framework=2, Design Patterns=2, docker=2, C/C++=2, Bash=2, Java Servlets=2, Nginx=2, RxJava=2, Eclipse=2, �������� ����=2, Perl=2, Xcode=2, Machine Learning=2, Data science=2, Groovy=2, React JS=2, ������������ ����������������� ����������=2, Unity=2, TDD=2, Jira=2, ���������� ����������=2, Sales Skills=2, Kubernetes=2, HW/OS selection/integration=1, Storm=1, ���� ������: Oracle=1, ����������� ������������=1, PostrgreSQL=1, TFS=1, LINQ=1, �������� �������=1, Hadoop=1, Google Docs=1, ��� ��=1, ���������� ������ ����������=1, �������������� ������=1, Liquibase=1, JTA=1, Script Programming=1, EJB=1, Transact-SQL=1, ������� �������=1, C=1, BI=1, ����������� �����������=1, ������������� ������������=1, Domino Developer=1, WebSockets=1, ��������������� ������=1, R=1, ISO 27002=1, ���-����=1, Akka Streams=1, �������������� ������=1, LotusScript=1, embedded=1, ��������� ���������� ����������� ����=1, CI=1, Artificial Intelligence=1, react native=1, NGFW=1, CUDA=1, Site Reliability=1, Apache Ignite=1, ����������� ������������=1, Unit Testing=1, DI=1, FIrewall=1, IBM Lotus Notes=1, Tagless Final=1, Performance testing=1, webdriver=1, multithreading=1, Instruments=1, Grails=1, AEM=1, Phalcon=1, EMV=1, CI/CD pipelines=1, Mobile development=1, ����� � ����������� ��������=1, PostgressSQL=1, Mercurial=1, ���������� �����������=1, Continuous Delivery=1, ����������� �����������=1, Oracle 11G=1, ReactiveX=1, ������-������=1, mobile=1, MariaDB=1, Oracle 10G=1, TDD/BDD=1, WebSocket=1, XPages=1, Ruby On Rails Ruby MySQL PHP5 Java Google Play=1, ������������� ��������=1, Python 3=1, Apple Store=1, ���� ������ �����=1, ��������������� ������=1, Jmeter=1, Payments=1, data pipeline=1, TCP/IP=1, ����������� �������� �������������=1, RESTful=1, quiz-�����=1, ��������� ���=1, �������������� �������������=1, Senior=1, kafka=1, Security testing=1, Unreal Engine 4=1, Bamboo=1, Charles Proxy=1, iPhone=1, Dagger2=1, ERP=1, ES6=1, SWIFT=1, SpringBoot=1, RxJava2=1, Scripting=1, Data Science=1, Java Script=1, SIEM=1, ����������=1, C������ ���������� ������ ������=1, ��������� ���������=1, PCI DSS=1, Web testing=1, MS Visual Studio=1, weblogic=1, RabbitMQ=1, High-load=1, ������ ����������� � ����� ����=1, OpenCV=1, CI/CD=1, Data Analysis=1, ���������� ���������=1, BigFix=1, Sencha=1, microservices=1, Object Pascal/Delphi=1, automation=1, ML=1, ClickHouse=1, Atlassian Confluence=1, Akka HTTP=1, ���������� ����������=1, Java EE6=1, Retrofit=1, ����������������=1, gitlab=1, BPM=1, RPA=1, Data Engineering=1, PaaS=1, Microsoft SQL=1, Android Core=1, ����������=1, TeamCity=1, Hazelcast=1, ��������������� �������=1, Borland Delphi=1, �������������=1, Salesforce Apex=1, �������������� ����������=1, IaC=1, HR manager=1, unity3d=1, Robotic Process Automation=1, SWIFT Alliance=1, Netflix Observers=1, Selenium WD=1, C ++=1, Qt=1, hybris=1, IDS/IPS=1, Business Analysis=1, JDK=1, �������������=1, Solidity=1, Swagger=1, ����������������� ������=1, Express=1, Rx=1, Appium=1, JEE=1, SQL Server=1, BPMN=1, Skype=1, katalon=1, ���������������� ��������� ������������=1, kubernetes=1, Joomla CMS=1, Lotus Domino=1, React native=1, Java scripting=1, Sales Management=1, Troubleshooting=1, MapReduce=1, REST API (JAVA FX)=1, SCCM=1, Embarcadero Delphi=1, Hive/Pig=1, Olap (online analytical processing)=1, flutter=1, gamedev=1, JSON/XML=1, ORM=1, Bug Reporting=1, Data Bases=1, JAVA 7-8=1, ���������� ���������=1, CMS Bitrix=1, �����������=1, JBoss=1, �������� ���������� �������=1, windows=1, Camunda=1, �������� � �������������� � �������=1, FastReport=1, .Net CORE=1, ���������� ���� (Intermediate)=1, react=1, Lightning force.com=1, PixiJS=1, Bank Software=1, Development=1, Organization Skills=1, Blockchain technologies=1, SaaS=1, Salesforce.com=1, HBase=1, Data solution achitecture=1, ������� ������� � �����=1, Game Programming=1, Android NDK=1, Testing frameworks=1, Akka=1, Xamarin=1, ���� ������=1, Software Architecture=1, MS Project=1, �������������� ����������=1, Computer Science=1, ����������� ����������������� �����=1, Interviews=1, ������ ��������� XML/XSLT=1, Cats=1, ������������ ��������=1, Hybrid apps=1, HTTP REST=1, �����������������=1, Community Cloud=1, Active MQ=1, Visualforce=1, Java Core=1, Data Mining=1, open cart=1, Hybris=1, ITIL=1, Deep Learning=1, Test automation=1, Hive=1, Vertica=1, Risk management=1, Wildfly=1, SAP=1, Leadership Skills=1, ������� ������ ������ ����� ����������������=1, PL/SQL=1, ����������=1, XLS=1, Tanzor Flow=1, J2EE=1, Oracle DB=1, ����������� ������-���������=1, OWASP=1, ������� ����������=1, Lotus Notes=1}

sandbox/search.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
java -cp ..\target\sandbox-core-1.0-SNAPSHOT-jar-with-dependencies.jar ^
3+
by.andd3dfx.sitesparsing.tutby.TutByJobSearchUtil ^
4+
output.txt
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
4+
<jmxConfigurator/>
5+
6+
<property name="APP_NAME" value="java-sandbox"/>
7+
<property name="LOG_LOCATION" value="/local/logs/spring-boot/sandboxapp"/>
8+
<property name="LOG_FILE_SIZE" value="100MB"/>
9+
<property name="ERROR_LOG_FILE_SIZE" value="100MB"/>
10+
<property name="LOG_PATTERN"
11+
value="%d{yyyy.MM.dd HH:mm:ss z} [%-5level] [%lo{1}]%X{transactionInfo}%X{akkaSource} %msg%n"/>
12+
13+
<springProfile name="local, test">
14+
<property name="CONSOLE_LOG_PATTERN" value="${LOG_PATTERN}"/>
15+
<property name="LOG_LOCATION" value="./build/logs"/>
16+
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
17+
</springProfile>
18+
19+
<springProfile name="qa, prod">
20+
<property name="LOG_LOCATION" value="/local/logs/spring-boot"/>
21+
</springProfile>
22+
23+
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
24+
<File>${LOG_LOCATION}/${APP_NAME}.log</File>
25+
<Append>true</Append>
26+
27+
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
28+
<FileNamePattern>${LOG_LOCATION}/${APP_NAME}.%i.log</FileNamePattern>
29+
<MinIndex>1</MinIndex>
30+
<MaxIndex>10</MaxIndex>
31+
</rollingPolicy>
32+
33+
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
34+
<MaxFileSize>${LOG_FILE_SIZE}</MaxFileSize>
35+
</triggeringPolicy>
36+
37+
<layout class="ch.qos.logback.classic.PatternLayout">
38+
<Pattern>${LOG_PATTERN}</Pattern>
39+
</layout>
40+
</appender>
41+
42+
<appender name="FILE-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
43+
<File>${LOG_LOCATION}/${APP_NAME}-error.log</File>
44+
<Append>true</Append>
45+
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
46+
<level>ERROR</level>
47+
</filter>
48+
49+
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
50+
<FileNamePattern>${LOG_LOCATION}/${APP_NAME}-error.%i.log</FileNamePattern>
51+
<MinIndex>1</MinIndex>
52+
<MaxIndex>10</MaxIndex>
53+
</rollingPolicy>
54+
55+
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
56+
<MaxFileSize>${ERROR_LOG_FILE_SIZE}</MaxFileSize>
57+
</triggeringPolicy>
58+
59+
<layout class="ch.qos.logback.classic.PatternLayout">
60+
<Pattern>${LOG_PATTERN}</Pattern>
61+
</layout>
62+
</appender>
63+
64+
<springProfile name="local, test">
65+
<root level="INFO">
66+
<appender-ref ref="CONSOLE"/>
67+
<appender-ref ref="FILE"/>
68+
<appender-ref ref="FILE-ERROR"/>
69+
</root>
70+
</springProfile>
71+
72+
<springProfile name="qa">
73+
<root level="INFO">
74+
<appender-ref ref="FILE"/>
75+
<appender-ref ref="FILE-ERROR"/>
76+
</root>
77+
</springProfile>
78+
79+
<springProfile name="prod">
80+
<root level="INFO">
81+
<appender-ref ref="FILE-ERROR"/>
82+
</root>
83+
</springProfile>
84+
85+
<logger name="org.springframework">
86+
<level value="INFO"/>
87+
</logger>
88+
89+
<logger name="com.ihg">
90+
<level value="INFO"/>
91+
</logger>
92+
93+
</configuration>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
Bowling
3+
4+
The coding test is a relatively simple problem to solve. This solution should be written in Java.
5+
Zip the code and send us a link to it using dropbox, google drive, or some other file-sharing solution.
6+
Once the code is submitted we put it into a repository and create a pull request to allow the entire team to review it.
7+
Just like all review processes, each team member will see the code from different angles. However, the general review will focus on the following items.
8+
* completeness - Does the solution solve the problem entirely?
9+
* compilation - Does the code compile?
10+
* cleanliness / readability - Can we understand the code? Is it clear what the code is doing?
11+
* test coverage - Is there sufficient test coverage. Is the code structured in such a way that it can be tested properly.
12+
* documentation - Is the documentation provided useful and clear.
13+
* does it work? - We execute the solution against our own test of 100k games.
14+
The instructions for the test are below.
15+
===================================
16+
17+
Write a program to score a game of Ten-Pin Bowling.
18+
19+
Input: string (described below) representing a bowling game
20+
Ouput: integer score
21+
22+
The scoring rules:
23+
24+
Each game, or "line" of bowling, includes ten turns,
25+
or "frames" for the bowler.
26+
27+
In each frame, the bowler gets up to two tries to
28+
knock down all ten pins.
29+
30+
If the first ball in a frame knocks down all ten pins,
31+
this is called a "strike". The frame is over. The score
32+
for the frame is ten plus the total of the pins knocked
33+
down in the next two balls.
34+
35+
If the second ball in a frame knocks down all ten pins,
36+
this is called a "spare". The frame is over. The score
37+
for the frame is ten plus the number of pins knocked
38+
down in the next ball.
39+
40+
If, after both balls, there is still at least one of the
41+
ten pins standing the score for that frame is simply
42+
the total number of pins knocked down in those two balls.
43+
44+
If you get a spare in the last (10th) frame you get one
45+
more bonus ball. If you get a strike in the last (10th)
46+
frame you get two more bonus balls.
47+
These bonus throws are taken as part of the same turn.
48+
If a bonus ball knocks down all the pins, the process
49+
does not repeat. The bonus balls are only used to
50+
calculate the score of the final frame.
51+
52+
The game score is the total of all frame scores.
53+
54+
Examples:
55+
X indicates a strike
56+
/ indicates a spare
57+
- indicates a miss
58+
| indicates a frame boundary
59+
The characters after the || indicate bonus balls
60+
61+
X|X|X|X|X|X|X|X|X|X||XX
62+
Ten strikes on the first ball of all ten frames.
63+
Two bonus balls, both strikes.
64+
Score for each frame == 10 + score for next two
65+
balls == 10 + 10 + 10 == 30
66+
Total score == 10 frames x 30 == 300
67+
68+
9-|9-|9-|9-|9-|9-|9-|9-|9-|9-||
69+
Nine pins hit on the first ball of all ten frames.
70+
Second ball of each frame misses last remaining pin.
71+
No bonus balls.
72+
Score for each frame == 9
73+
Total score == 10 frames x 9 == 90
74+
75+
5/|5/|5/|5/|5/|5/|5/|5/|5/|5/||5
76+
Five pins on the first ball of all ten frames.
77+
Second ball of each frame hits all five remaining
78+
pins, a spare.
79+
One bonus ball, hits five pins.
80+
Score for each frame == 10 + score for next one
81+
ball == 10 + 5 == 15
82+
Total score == 10 frames x 15 == 150
83+
84+
X|7/|9-|X|-8|8/|-6|X|X|X||81
85+
Total score == 167
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package by.andd3dfx.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Retention(RetentionPolicy.RUNTIME)
9+
@Target(ElementType.METHOD)
10+
public @interface CustomAnnotation {
11+
12+
int value() default 21;
13+
}

0 commit comments

Comments
 (0)