@xiangyang9999/folib-server-sync-a8be7ecd6f05 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +57 -2
  2. package/bin/folib-commit-sync.js +70 -0
  3. package/package.json +22 -4
  4. package/payload/INSTRUCTIONS.docx +0 -0
  5. package/payload/changes.patch +1538 -0
  6. package/payload/manifest.json +367 -0
  7. package/payload/manifest.sha256 +41 -0
  8. package/payload/source-files.zip +0 -0
  9. package/source/SECURITY_DEPENDENCY_UPGRADE.md +97 -0
  10. package/source/folib-client/pom.xml +160 -0
  11. package/source/folib-commons/folib-commons-core/pom.xml +297 -0
  12. package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java +86 -0
  13. package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java +148 -0
  14. package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java +77 -0
  15. package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java +286 -0
  16. package/source/folib-commons/folib-commons-io/pom.xml +184 -0
  17. package/source/folib-data-service/pom.xml +259 -0
  18. package/source/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java +124 -0
  19. package/source/folib-rest-client/pom.xml +166 -0
  20. package/source/folib-security/folib-authentication-registry/pom.xml +117 -0
  21. package/source/folib-security/folib-security-api/pom.xml +416 -0
  22. package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java +251 -0
  23. package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java +72 -0
  24. package/source/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml +236 -0
  25. package/source/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml +187 -0
  26. package/source/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml +180 -0
  27. package/source/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml +125 -0
  28. package/source/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml +193 -0
  29. package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml +101 -0
  30. package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml +179 -0
  31. package/source/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml +162 -0
  32. package/source/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml +155 -0
  33. package/source/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml +116 -0
  34. package/source/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml +170 -0
  35. package/source/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml +278 -0
  36. package/source/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml +183 -0
  37. package/source/folib-web-core/pom.xml +1089 -0
  38. package/source/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java +67 -0
  39. package/source/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java +41 -0
  40. package/source/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java +377 -0
  41. package/source/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java +16 -0
  42. package/source/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java +202 -0
  43. package/source/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java +75 -0
  44. package/source/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java +31 -0
  45. package/source/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java +112 -0
  46. package/source/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java +62 -0
@@ -0,0 +1,184 @@
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+ <parent>
7
+ <groupId>com.veadan.folib</groupId>
8
+ <artifactId>folib-parent</artifactId>
9
+ <version>3.0-SNAPSHOT</version>
10
+ <relativePath/>
11
+ </parent>
12
+ <groupId>com.veadan.folib.commons</groupId>
13
+ <artifactId>folib-commons-io</artifactId>
14
+ <name>Folib: Commons Io</name>
15
+ <packaging>jar</packaging>
16
+ <scm>
17
+ <url>http://git.folib.com/folib/folib-server</url>
18
+ <connection>scm:git:git://git.folib.com/folib/folib-server.git</connection>
19
+ <developerConnection>scm:git:git://git.folib.com/folib/folib-server.git</developerConnection>
20
+ </scm>
21
+ <properties>
22
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23
+
24
+ <version.jcl>1.7.25</version.jcl>
25
+ <version.slf4j>1.7.24</version.slf4j>
26
+ <version.logback>1.2.3</version.logback>
27
+ </properties>
28
+
29
+ <build>
30
+ <plugins>
31
+ <plugin>
32
+ <groupId>org.apache.maven.plugins</groupId>
33
+ <artifactId>maven-compiler-plugin</artifactId>
34
+ <version>3.7.0</version>
35
+
36
+ <configuration>
37
+ <source>1.8</source>
38
+ <target>1.8</target>
39
+ <debug>true</debug>
40
+ </configuration>
41
+ </plugin>
42
+ <plugin>
43
+ <groupId>org.apache.maven.plugins</groupId>
44
+ <artifactId>maven-source-plugin</artifactId>
45
+ <version>3.0.1</version>
46
+
47
+ <executions>
48
+ <execution>
49
+ <id>attach-sources</id>
50
+ <goals>
51
+ <goal>jar</goal>
52
+ </goals>
53
+ </execution>
54
+ </executions>
55
+ </plugin>
56
+
57
+ <plugin>
58
+ <groupId>com.amashchenko.maven.plugin</groupId>
59
+ <artifactId>gitflow-maven-plugin</artifactId>
60
+ <version>1.11.0</version>
61
+ <configuration>
62
+ <gitFlowConfig>
63
+ <developmentBranch>master</developmentBranch>
64
+ </gitFlowConfig>
65
+ <commitMessages>
66
+ <!--
67
+ The release finish message specifically does not have a [release], so that Jenkins
68
+ will build the new development version.
69
+ -->
70
+ <releaseFinishMessage>[release] Set the next development version.</releaseFinishMessage>
71
+ <releaseFinishMergeMessage>[release] Merge branch release/@{version}</releaseFinishMergeMessage>
72
+ <tagReleaseMessage>[release] Tag release</tagReleaseMessage>
73
+ <releaseFinishMergeMessage>[release] Merge branch 'release/@{version}'
74
+ </releaseFinishMergeMessage>
75
+ </commitMessages>
76
+ </configuration>
77
+ </plugin>
78
+
79
+ <!-- JUnit 5 requires Surefire version 2.22.1 or higher -->
80
+ <plugin>
81
+ <artifactId>maven-surefire-plugin</artifactId>
82
+ <version>2.22.1</version>
83
+ <configuration>
84
+ <systemPropertyVariables>
85
+ <logback.configurationFile>logback.xml</logback.configurationFile>
86
+ </systemPropertyVariables>
87
+ </configuration>
88
+ </plugin>
89
+ </plugins>
90
+ </build>
91
+
92
+ <dependencies>
93
+ <dependency>
94
+ <groupId>com.veadan.folib.commons</groupId>
95
+ <artifactId>folib-commons-http</artifactId>
96
+ <version>${project.version}</version>
97
+ </dependency>
98
+
99
+ <!-- Logging -->
100
+ <dependency>
101
+ <groupId>org.slf4j</groupId>
102
+ <artifactId>jcl-over-slf4j</artifactId>
103
+ <version>${version.jcl}</version>
104
+ </dependency>
105
+ <dependency>
106
+ <groupId>org.slf4j</groupId>
107
+ <artifactId>jul-to-slf4j</artifactId>
108
+ <version>${version.jcl}</version>
109
+ </dependency>
110
+ <dependency>
111
+ <groupId>ch.qos.logback</groupId>
112
+ <artifactId>logback-classic</artifactId>
113
+ <version>${version.logback}</version>
114
+ </dependency>
115
+ <!-- Logging -->
116
+
117
+ <dependency>
118
+ <groupId>org.junit.jupiter</groupId>
119
+ <artifactId>junit-jupiter</artifactId>
120
+ <version>5.5.0</version>
121
+ </dependency>
122
+ <dependency>
123
+ <groupId>commons-io</groupId>
124
+ <artifactId>commons-io</artifactId>
125
+ </dependency>
126
+ </dependencies>
127
+
128
+ <distributionManagement>
129
+ <repository>
130
+ <id>folib-local-maven</id>
131
+ <url>https://public.bocloud.com.cn/storages/folib/folib-maven-local</url>
132
+ </repository>
133
+ </distributionManagement>
134
+
135
+ <profiles>
136
+ <profile>
137
+ <id>sign-artifacts</id>
138
+ <activation>
139
+ <activeByDefault>false</activeByDefault>
140
+ </activation>
141
+ <build>
142
+ <plugins>
143
+ <plugin>
144
+ <groupId>org.apache.maven.plugins</groupId>
145
+ <artifactId>maven-javadoc-plugin</artifactId>
146
+ <version>3.1.0</version>
147
+ <executions>
148
+ <execution>
149
+ <phase>package</phase>
150
+ <goals>
151
+ <goal>jar</goal>
152
+ </goals>
153
+ </execution>
154
+ </executions>
155
+ </plugin>
156
+ <plugin>
157
+ <groupId>org.apache.maven.plugins</groupId>
158
+ <artifactId>maven-gpg-plugin</artifactId>
159
+ <version>1.6</version>
160
+ <executions>
161
+ <execution>
162
+ <id>sign-artifacts</id>
163
+ <phase>verify</phase>
164
+ <goals>
165
+ <goal>sign</goal>
166
+ </goals>
167
+ <configuration>
168
+ <keyname>${gpg.keyid}</keyname>
169
+ <gpgArguments>
170
+ <arg>--pinentry-mode</arg>
171
+ <arg>loopback</arg>
172
+ <arg>--passphrase-file</arg>
173
+ <arg>${gpg.passfile}</arg>
174
+ </gpgArguments>
175
+ </configuration>
176
+ </execution>
177
+ </executions>
178
+ </plugin>
179
+ </plugins>
180
+ </build>
181
+ </profile>
182
+ </profiles>
183
+
184
+ </project>
@@ -0,0 +1,259 @@
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
+ <parent>
6
+ <artifactId>folib-parent</artifactId>
7
+ <groupId>com.veadan.folib</groupId>
8
+ <version>3.0-SNAPSHOT</version>
9
+ <relativePath/>
10
+ </parent>
11
+ <modelVersion>4.0.0</modelVersion>
12
+
13
+ <artifactId>folib-data-service</artifactId>
14
+ <packaging>jar</packaging>
15
+ <name>Folib: Data Service</name>
16
+ <inceptionYear>2019</inceptionYear>
17
+ <properties>
18
+ <dir.folib.home>${project.build.directory}/folib</dir.folib.home>
19
+ <dir.folib.vault>${project.build.directory}/folib-vault</dir.folib.vault>
20
+ <dir.jetty.etc>${dir.folib.home}/etc/jetty</dir.jetty.etc>
21
+ </properties>
22
+
23
+ <build>
24
+ <plugins>
25
+ <plugin>
26
+ <groupId>org.apache.maven.plugins</groupId>
27
+ <artifactId>maven-compiler-plugin</artifactId>
28
+ <configuration>
29
+ <!-- <annotationProcessors>-->
30
+ <!-- <annotationProcessor>org.apache.tinkerpop.gremlin.process.traversal.dsl.GremlinDslProcessor</annotationProcessor>-->
31
+ <!-- </annotationProcessors>-->
32
+ <source>17</source>
33
+ <target>17</target>
34
+ </configuration>
35
+ </plugin>
36
+ <plugin>
37
+ <groupId>org.apache.maven.plugins</groupId>
38
+ <artifactId>maven-source-plugin</artifactId>
39
+ </plugin>
40
+ <plugin>
41
+ <groupId>org.apache.maven.plugins</groupId>
42
+ <artifactId>maven-dependency-plugin</artifactId>
43
+ </plugin>
44
+ <plugin>
45
+ <groupId>org.apache.maven.plugins</groupId>
46
+ <artifactId>maven-surefire-plugin</artifactId>
47
+
48
+ <configuration>
49
+ <systemPropertyVariables>
50
+ <folib.home>${project.build.directory}/folib</folib.home>
51
+ <folib.vault>${project.build.directory}/folib-vault</folib.vault>
52
+ </systemPropertyVariables>
53
+ </configuration>
54
+ </plugin>
55
+ </plugins>
56
+ </build>
57
+
58
+ <dependencies>
59
+ <dependency>
60
+ <groupId>com.veadan.folib</groupId>
61
+ <artifactId>folib-storage-api-resources</artifactId>
62
+ <version>${project.version}</version>
63
+ </dependency>
64
+ <dependency>
65
+ <groupId>${project.groupId}</groupId>
66
+ <artifactId>folib-commons-core</artifactId>
67
+ <version>${project.version}</version>
68
+ </dependency>
69
+ <dependency>
70
+ <groupId>${project.groupId}</groupId>
71
+ <artifactId>folib-db-server</artifactId>
72
+ <version>${project.version}</version>
73
+ </dependency>
74
+ <dependency>
75
+ <groupId>${project.groupId}</groupId>
76
+ <artifactId>folib-db-schema</artifactId>
77
+ <version>${project.version}</version>
78
+ </dependency>
79
+
80
+
81
+ <!-- <dependency>-->
82
+ <!-- <groupId>${project.groupId}</groupId>-->
83
+ <!-- <artifactId>folib-db-import</artifactId>-->
84
+ <!-- <version>${project.version}</version>-->
85
+ <!-- <classifier>schema</classifier>-->
86
+ <!-- </dependency>-->
87
+ <dependency>
88
+ <groupId>${project.groupId}</groupId>
89
+ <artifactId>folib-commons-resources</artifactId>
90
+ <version>${project.version}</version>
91
+ </dependency>
92
+
93
+ <!-- <dependency>-->
94
+ <!-- <groupId>javax.inject</groupId>-->
95
+ <!-- <artifactId>javax.inject</artifactId>-->
96
+ <!-- </dependency>-->
97
+
98
+ <dependency>
99
+ <groupId>commons-beanutils</groupId>
100
+ <artifactId>commons-beanutils</artifactId>
101
+ </dependency>
102
+
103
+ <dependency>
104
+ <groupId>com.hazelcast</groupId>
105
+ <artifactId>hazelcast-spring</artifactId>
106
+ </dependency>
107
+
108
+ <dependency>
109
+ <groupId>org.springframework</groupId>
110
+ <artifactId>spring-context</artifactId>
111
+ </dependency>
112
+ <dependency>
113
+ <groupId>org.springframework</groupId>
114
+ <artifactId>spring-context-support</artifactId>
115
+ </dependency>
116
+ <dependency>
117
+ <groupId>org.springframework</groupId>
118
+ <artifactId>spring-web</artifactId>
119
+ </dependency>
120
+ <dependency>
121
+ <groupId>org.springframework</groupId>
122
+ <artifactId>spring-aop</artifactId>
123
+ </dependency>
124
+ <dependency>
125
+ <groupId>javax.persistence</groupId>
126
+ <artifactId>javax.persistence-api</artifactId>
127
+ </dependency>
128
+
129
+ <dependency>
130
+ <groupId>org.aspectj</groupId>
131
+ <artifactId>aspectjrt</artifactId>
132
+ </dependency>
133
+ <dependency>
134
+ <groupId>org.aspectj</groupId>
135
+ <artifactId>aspectjweaver</artifactId>
136
+ </dependency>
137
+
138
+ <dependency>
139
+ <groupId>org.springframework</groupId>
140
+ <artifactId>spring-orm</artifactId>
141
+ </dependency>
142
+
143
+ <dependency>
144
+ <groupId>org.springframework.security</groupId>
145
+ <artifactId>spring-security-core</artifactId>
146
+ </dependency>
147
+
148
+ <dependency>
149
+ <groupId>com.fasterxml.jackson.core</groupId>
150
+ <artifactId>jackson-databind</artifactId>
151
+ </dependency>
152
+
153
+ <dependency>
154
+ <groupId>com.fasterxml.jackson.module</groupId>
155
+ <artifactId>jackson-module-jaxb-annotations</artifactId>
156
+ </dependency>
157
+
158
+ <dependency>
159
+ <groupId>com.fasterxml.jackson.core</groupId>
160
+ <artifactId>jackson-annotations</artifactId>
161
+ </dependency>
162
+
163
+ <dependency>
164
+ <groupId>com.google.guava</groupId>
165
+ <artifactId>guava</artifactId>
166
+ </dependency>
167
+ <dependency>
168
+ <groupId>com.google.code.findbugs</groupId>
169
+ <artifactId>jsr305</artifactId>
170
+ </dependency>
171
+
172
+ <dependency>
173
+ <groupId>org.hibernate.validator</groupId>
174
+ <artifactId>hibernate-validator</artifactId>
175
+ <version>8.0.2.Final</version>
176
+ </dependency>
177
+
178
+ <dependency>
179
+ <groupId>org.antlr</groupId>
180
+ <artifactId>antlr4-runtime</artifactId>
181
+ </dependency>
182
+
183
+ <dependency>
184
+ <groupId>org.javatuples</groupId>
185
+ <artifactId>javatuples</artifactId>
186
+ </dependency>
187
+
188
+ <dependency>
189
+ <groupId>org.apache.commons</groupId>
190
+ <artifactId>commons-lang3</artifactId>
191
+ </dependency>
192
+
193
+ <dependency>
194
+ <groupId>org.springframework.data</groupId>
195
+ <artifactId>spring-data-commons</artifactId>
196
+ <version>2.4.15</version>
197
+ </dependency>
198
+
199
+ <dependency>
200
+ <groupId>org.springframework.data</groupId>
201
+ <artifactId>spring-data-neo4j</artifactId>
202
+ <exclusions>
203
+ <exclusion>
204
+ <groupId>org.neo4j</groupId>
205
+ <artifactId>neo4j-ogm-bolt-driver</artifactId>
206
+ </exclusion>
207
+ </exclusions>
208
+ </dependency>
209
+
210
+
211
+ <!-- <dependency>-->
212
+ <!-- <groupId>javax.transaction</groupId>-->
213
+ <!-- <artifactId>javax.transaction-api</artifactId>-->
214
+ <!-- </dependency>-->
215
+ <dependency>
216
+ <groupId>jakarta.transaction</groupId>
217
+ <artifactId>jakarta.transaction-api</artifactId>
218
+ <version>2.0.1</version> <!-- 最新稳定版 -->
219
+ </dependency>
220
+ <dependency>
221
+ <groupId>org.neo4j</groupId>
222
+ <artifactId>neo4j-ogm-core</artifactId>
223
+ <exclusions>
224
+ <exclusion>
225
+ <groupId>io.github.classgraph</groupId>
226
+ <artifactId>classgraph</artifactId>
227
+ </exclusion>
228
+ </exclusions>
229
+ </dependency>
230
+ <dependency>
231
+ <groupId>io.github.classgraph</groupId>
232
+ <artifactId>classgraph</artifactId>
233
+ <version>4.8.178</version>
234
+ </dependency>
235
+
236
+ <dependency>
237
+ <groupId>org.psjava</groupId>
238
+ <artifactId>psjava</artifactId>
239
+ <version>0.1.19</version>
240
+ </dependency>
241
+ <dependency>
242
+ <groupId>org.apache.tinkerpop</groupId>
243
+ <artifactId>gremlin-core</artifactId>
244
+ <version>3.7.3</version>
245
+ </dependency>
246
+ <dependency>
247
+ <groupId>jakarta.inject</groupId>
248
+ <artifactId>jakarta.inject-api</artifactId>
249
+ <version>2.0.1</version>
250
+ </dependency>
251
+ <dependency>
252
+ <groupId>org.junit.jupiter</groupId>
253
+ <artifactId>junit-jupiter</artifactId>
254
+ <scope>test</scope>
255
+ </dependency>
256
+
257
+ </dependencies>
258
+
259
+ </project>
@@ -0,0 +1,124 @@
1
+ package com.veadan.folib.config.hazelcast;
2
+
3
+ import com.hazelcast.config.Config;
4
+ import com.hazelcast.config.EvictionPolicy;
5
+ import com.hazelcast.config.MaxSizePolicy;
6
+ import com.hazelcast.core.HazelcastInstance;
7
+ import com.veadan.folib.components.DistributedCacheComponent;
8
+ import com.veadan.folib.components.DistributedLockComponent;
9
+ import org.junit.jupiter.api.Test;
10
+ import org.junit.jupiter.api.Timeout;
11
+
12
+ import java.lang.reflect.Field;
13
+ import java.net.InetAddress;
14
+ import java.net.ServerSocket;
15
+ import java.util.UUID;
16
+ import java.util.concurrent.TimeUnit;
17
+
18
+ import static org.junit.jupiter.api.Assertions.*;
19
+
20
+ class HazelcastClusterCompatibilityTest {
21
+
22
+ @Test
23
+ @Timeout(value = 90, unit = TimeUnit.SECONDS)
24
+ void twoTcpMembersShareCacheAndDistributedLocks() throws Exception {
25
+ int firstPort;
26
+ int secondPort;
27
+ try (ServerSocket first = new ServerSocket(0, 1, InetAddress.getLoopbackAddress());
28
+ ServerSocket second = new ServerSocket(0, 1, InetAddress.getLoopbackAddress())) {
29
+ firstPort = first.getLocalPort();
30
+ secondPort = second.getLocalPort();
31
+ }
32
+
33
+ String clusterName = "folib-compat-" + UUID.randomUUID();
34
+ String[] members = {"127.0.0.1:" + firstPort, "127.0.0.1:" + secondPort};
35
+ HazelcastConfiguration firstConfig = configuration(clusterName, firstPort, members);
36
+ HazelcastConfiguration secondConfig = configuration(clusterName, secondPort, members);
37
+
38
+ HazelcastInstance first = null;
39
+ HazelcastInstance second = null;
40
+ try {
41
+ first = firstConfig.hazelcastInstance(memberConfig(firstConfig, "compat-first-" + clusterName));
42
+ second = secondConfig.hazelcastInstance(memberConfig(secondConfig, "compat-second-" + clusterName));
43
+
44
+ long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(20);
45
+ while ((first.getCluster().getMembers().size() != 2 || second.getCluster().getMembers().size() != 2)
46
+ && System.nanoTime() < deadline) {
47
+ Thread.sleep(100);
48
+ }
49
+ assertEquals(2, first.getCluster().getMembers().size());
50
+ assertEquals(2, second.getCluster().getMembers().size());
51
+
52
+ DistributedCacheComponent cache1 = inject(new DistributedCacheComponent(), first);
53
+ DistributedCacheComponent cache2 = inject(new DistributedCacheComponent(), second);
54
+ cache1.put("cluster-compat-key", "value");
55
+ assertEquals("value", cache2.get("cluster-compat-key"));
56
+ cache2.delete("cluster-compat-key");
57
+ assertNull(cache1.get("cluster-compat-key"));
58
+
59
+ DistributedLockComponent lock1 = inject(new DistributedLockComponent(), first);
60
+ DistributedLockComponent lock2 = inject(new DistributedLockComponent(), second);
61
+ assertTrue(lock1.lock("cluster-compat-lock", 5, TimeUnit.SECONDS));
62
+ try {
63
+ assertFalse(lock2.lock("cluster-compat-lock", 200, TimeUnit.MILLISECONDS));
64
+ } finally {
65
+ lock1.unLock("cluster-compat-lock");
66
+ }
67
+ assertTrue(lock2.lock("cluster-compat-lock", 5, TimeUnit.SECONDS));
68
+ lock2.unLock("cluster-compat-lock");
69
+ } finally {
70
+ if (second != null) {
71
+ second.getLifecycleService().shutdown();
72
+ }
73
+ if (first != null) {
74
+ first.getLifecycleService().shutdown();
75
+ }
76
+ }
77
+ }
78
+
79
+ private Config memberConfig(HazelcastConfiguration source, String instanceName) {
80
+ Config config = source.hazelcastConfig(new HazelcastInstanceId(instanceName));
81
+ // Restrict only this test's nodes. The production network settings are untouched.
82
+ config.getNetworkConfig().getInterfaces().setEnabled(true).addInterface("127.0.0.1");
83
+ config.getNetworkConfig().setPortAutoIncrement(false);
84
+ config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
85
+ config.setProperty("hazelcast.partition.count", "17");
86
+ config.setProperty("hazelcast.operation.thread.count", "2");
87
+ config.setProperty("hazelcast.operation.generic.thread.count", "2");
88
+ config.setProperty("hazelcast.io.input.thread.count", "1");
89
+ config.setProperty("hazelcast.io.output.thread.count", "1");
90
+ config.setProperty("hazelcast.event.thread.count", "2");
91
+ config.setProperty("hazelcast.shutdownhook.enabled", "false");
92
+ return config;
93
+ }
94
+
95
+ private HazelcastConfiguration configuration(String clusterName, int port, String[] members) {
96
+ HazelcastConfiguration configuration = new HazelcastConfiguration();
97
+ configuration.groupConfigName = clusterName;
98
+ configuration.tcpIpPort = port;
99
+ configuration.enableTcpIpConfig = true;
100
+ configuration.tcpIpMembers = members;
101
+ configuration.tcpIpTimeoutSeconds = 5;
102
+ configuration.splitBrainProtectionEnabled = true;
103
+ configuration.splitBrainProtectionMinimumClusterSize = 2;
104
+ configuration.remoteRepositoryAlivenessMaxSizeLimit = 1000;
105
+ configuration.remoteRepositoryAlivenessMaxSizePolicy = MaxSizePolicy.FREE_HEAP_SIZE;
106
+ configuration.remoteRepositoryAlivenessEvictionPolicy = EvictionPolicy.LFU;
107
+ configuration.tagsMaxSizeLimit = 1000;
108
+ configuration.tagsMaxSizePolicy = MaxSizePolicy.FREE_HEAP_SIZE;
109
+ configuration.tagsEvictionPolicy = EvictionPolicy.LFU;
110
+ configuration.authenticationsCacheInvalidateInterval = 10;
111
+ configuration.authenticationsCacheCacheLocalEntries = true;
112
+ configuration.authenticationsCacheEvictionConfigSize = 1000;
113
+ configuration.authenticationsCacheEvictionConfigMaxSizePolicy = MaxSizePolicy.ENTRY_COUNT;
114
+ configuration.authenticationsCacheInvalidateOnChange = true;
115
+ return configuration;
116
+ }
117
+
118
+ private <T> T inject(T component, HazelcastInstance instance) throws Exception {
119
+ Field field = component.getClass().getDeclaredField("hazelcastInstance");
120
+ field.setAccessible(true);
121
+ field.set(component, instance);
122
+ return component;
123
+ }
124
+ }