1+ /*
2+ * Copyright 2025 Flamingock (https://www.flamingock.io)
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package io .flamingock .support .inmemory ;
17+
18+ import io .flamingock .internal .common .core .context .Context ;
19+ import io .flamingock .internal .core .builder .CommunityChangeRunnerBuilder ;
20+ import io .flamingock .internal .core .configuration .community .CommunityConfiguration ;
21+ import io .flamingock .internal .core .configuration .core .CoreConfiguration ;
22+ import io .flamingock .internal .core .context .SimpleContext ;
23+ import io .flamingock .internal .core .plugin .DefaultPluginManager ;
24+ import io .flamingock .internal .core .plugin .PluginManager ;
25+
26+ /**
27+ * Specialized Flamingock builder for testing purposes.
28+ *
29+ * <p>This builder extends CommunityFlamingockBuilder and is pre-configured with test-specific
30+ * settings and drivers. It's created by TestKit implementations and provides the same API
31+ * as production builders but optimized for testing scenarios.</p>
32+ *
33+ * <p><strong>Usage:</strong></p>
34+ * <pre>{@code
35+ * TestFlamingockBuilder builder = testKit.createBuilder();
36+ *
37+ * // Configure for testing (common settings)
38+ * builder.addTargetSystem(new DefaultTargetSystem("test-system"));
39+ *
40+ * // Build and run
41+ * builder.build().run();
42+ * }</pre>
43+ *
44+ * <p>Typically used through TestKit.createBuilder() rather than directly instantiated.</p>
45+ */
46+ public class InMemoryFlamingockBuilder extends CommunityChangeRunnerBuilder {
47+
48+
49+ public static InMemoryFlamingockBuilder create () {
50+ return new InMemoryFlamingockBuilder (
51+ new CoreConfiguration (),
52+ new CommunityConfiguration (),
53+ new SimpleContext (),
54+ new DefaultPluginManager (),
55+ InMemoryAuditStore .create ()
56+ );
57+ }
58+
59+ private InMemoryFlamingockBuilder (CoreConfiguration coreConfiguration ,
60+ CommunityConfiguration communityConfiguration ,
61+ Context dependencyInjectableContext ,
62+ PluginManager pluginManager ,
63+ InMemoryAuditStore auditStore ) {
64+ super (coreConfiguration , communityConfiguration , dependencyInjectableContext , pluginManager , auditStore );
65+ this .auditStore = auditStore ;
66+ }
67+
68+ @ Override
69+ protected InMemoryFlamingockBuilder getSelf () {
70+ return this ;
71+ }
72+
73+ public InMemoryAuditStore getAuditStore () {
74+ return (InMemoryAuditStore ) auditStore ;
75+ }
76+ }
0 commit comments