Skip to content

Commit 3dd373a

Browse files
committed
NIFI-9770 Updated dependencies and made changes requested in a PR
1 parent 822575e commit 3dd373a

File tree

34 files changed

+377
-229
lines changed

34 files changed

+377
-229
lines changed

nifi-code-coverage/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,6 @@
720720
<artifactId>nifi-box-services-api</artifactId>
721721
<version>2.5.0-SNAPSHOT</version>
722722
</dependency>
723-
<dependency>
724-
<groupId>org.apache.nifi</groupId>
725-
<artifactId>nifi-cql-cache-services</artifactId>
726-
<version>2.5.0-SNAPSHOT</version>
727-
</dependency>
728723
<dependency>
729724
<groupId>org.apache.nifi</groupId>
730725
<artifactId>nifi-cql-processors</artifactId>

nifi-extension-bundles/nifi-cql-bundle/nifi-cassandra-session-provider-service/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<packaging>jar</packaging>
2626

2727
<properties>
28-
<driver.version>4.17.0</driver.version>
28+
<driver.version>4.19.0</driver.version>
2929
</properties>
3030

3131
<dependencies>
@@ -45,7 +45,7 @@
4545
</dependency>
4646

4747
<dependency>
48-
<groupId>com.datastax.oss</groupId>
48+
<groupId>org.apache.cassandra</groupId>
4949
<artifactId>java-driver-core</artifactId>
5050
<version>${driver.version}</version>
5151
</dependency>
Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.nifi.service;
17+
package org.apache.nifi.service.cassandra;
1818

1919
import com.datastax.oss.driver.api.core.CqlSession;
2020
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
@@ -53,23 +53,22 @@
5353
import org.apache.nifi.annotation.lifecycle.OnDisabled;
5454
import org.apache.nifi.annotation.lifecycle.OnEnabled;
5555
import org.apache.nifi.avro.AvroTypeUtil;
56-
import org.apache.nifi.cassandra.api.CQLExecutionService;
57-
import org.apache.nifi.cassandra.api.CqlFieldInfo;
58-
import org.apache.nifi.cassandra.api.CqlQueryCallback;
59-
import org.apache.nifi.cassandra.api.UpdateMethod;
60-
import org.apache.nifi.cassandra.api.exception.QueryFailureException;
6156
import org.apache.nifi.components.PropertyDescriptor;
6257
import org.apache.nifi.components.PropertyValue;
6358
import org.apache.nifi.controller.AbstractControllerService;
6459
import org.apache.nifi.controller.ConfigurationContext;
65-
import org.apache.nifi.controller.ControllerServiceInitializationContext;
6660
import org.apache.nifi.processor.exception.ProcessException;
6761
import org.apache.nifi.serialization.record.MapRecord;
6862
import org.apache.nifi.serialization.record.RecordFieldType;
6963
import org.apache.nifi.serialization.record.RecordSchema;
7064
import org.apache.nifi.serialization.record.type.ArrayDataType;
71-
import org.apache.nifi.service.mapping.FlexibleCounterCodec;
72-
import org.apache.nifi.service.mapping.JavaSQLTimestampCodec;
65+
import org.apache.nifi.service.cassandra.mapping.FlexibleCounterCodec;
66+
import org.apache.nifi.service.cassandra.mapping.JavaSQLTimestampCodec;
67+
import org.apache.nifi.service.cql.api.CQLExecutionService;
68+
import org.apache.nifi.service.cql.api.CQLFieldInfo;
69+
import org.apache.nifi.service.cql.api.CQLQueryCallback;
70+
import org.apache.nifi.service.cql.api.UpdateMethod;
71+
import org.apache.nifi.service.cql.api.exception.QueryFailureException;
7372
import org.apache.nifi.ssl.SSLContextService;
7473

7574
import javax.net.ssl.SSLContext;
@@ -94,37 +93,31 @@ public class CassandraCQLExecutionService extends AbstractControllerService impl
9493

9594
// Common descriptors
9695

97-
private List<PropertyDescriptor> properties;
9896
private CqlSession cassandraSession;
9997

10098
private Map<String, PreparedStatement> statementCache;
10199

102100
private String keyspace;
103101
private int pageSize;
104102

105-
@Override
106-
public void init(final ControllerServiceInitializationContext context) {
107-
List<PropertyDescriptor> props = new ArrayList<>();
108-
109-
props.add(CONTACT_POINTS);
110-
props.add(CLIENT_AUTH);
111-
props.add(DATACENTER);
112-
props.add(KEYSPACE);
113-
props.add(USERNAME);
114-
props.add(PASSWORD);
115-
props.add(PROP_SSL_CONTEXT_SERVICE);
116-
props.add(FETCH_SIZE);
117-
props.add(READ_TIMEOUT);
118-
props.add(CONNECT_TIMEOUT);
119-
props.add(CONSISTENCY_LEVEL);
120-
props.add(COMPRESSION_TYPE);
121-
122-
properties = props;
123-
}
103+
public static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = List.of(
104+
CONTACT_POINTS,
105+
CLIENT_AUTH,
106+
DATACENTER,
107+
KEYSPACE,
108+
USERNAME,
109+
PASSWORD,
110+
PROP_SSL_CONTEXT_SERVICE,
111+
FETCH_SIZE,
112+
READ_TIMEOUT,
113+
CONNECT_TIMEOUT,
114+
CONSISTENCY_LEVEL,
115+
COMPRESSION_TYPE
116+
);
124117

125118
@Override
126119
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
127-
return properties;
120+
return PROPERTY_DESCRIPTORS;
128121
}
129122

130123
@OnEnabled
@@ -233,7 +226,7 @@ private List<InetSocketAddress> getContactPoints(String contactPointList) {
233226
}
234227

235228
@Override
236-
public void query(String cql, boolean cacheStatement, List parameters, CqlQueryCallback callback) throws QueryFailureException {
229+
public void query(String cql, boolean cacheStatement, List parameters, CQLQueryCallback callback) throws QueryFailureException {
237230
SimpleStatement statement = SimpleStatement.builder(cql)
238231
.setPageSize(pageSize).build();
239232
PreparedStatement preparedStatement = cassandraSession.prepare(statement);
@@ -247,7 +240,7 @@ public void query(String cql, boolean cacheStatement, List parameters, CqlQueryC
247240
Iterator<Row> resultsIterator = results.iterator();
248241
long rowNumber = 0;
249242

250-
List<CqlFieldInfo> columnDefinitions = new ArrayList<>();
243+
List<CQLFieldInfo> columnDefinitions = new ArrayList<>();
251244
AtomicReference<RecordSchema> schemaReference = new AtomicReference<>();
252245

253246
try {
@@ -263,7 +256,7 @@ public void query(String cql, boolean cacheStatement, List parameters, CqlQueryC
263256

264257
if (columnDefinitions.isEmpty()) {
265258
row.getColumnDefinitions().forEach(def -> {
266-
CqlFieldInfo info = new CqlFieldInfo(def.getName().toString(),
259+
CQLFieldInfo info = new CQLFieldInfo(def.getName().toString(),
267260
def.getType().toString(), def.getType().getProtocolCode());
268261
columnDefinitions.add(info);
269262
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.nifi.service.mapping;
18+
package org.apache.nifi.service.cassandra.mapping;
1919

2020
import com.datastax.oss.driver.api.core.ProtocolVersion;
2121
import com.datastax.oss.driver.api.core.type.DataType;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.nifi.service.mapping;
18+
package org.apache.nifi.service.cassandra.mapping;
1919

2020
import com.datastax.oss.driver.api.core.ProtocolVersion;
2121
import com.datastax.oss.driver.api.core.type.DataType;

nifi-extension-bundles/nifi-cql-bundle/nifi-cassandra-session-provider-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
org.apache.nifi.service.CassandraCQLExecutionService
16+
org.apache.nifi.service.cassandra.CassandraCQLExecutionService
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.nifi.service;
18+
package org.apache.nifi.service.cassandra;
1919

2020
import com.datastax.oss.driver.api.core.CqlSession;
2121
import com.datastax.oss.driver.api.core.cql.ResultSet;
2222
import com.datastax.oss.driver.api.core.cql.Row;
23-
import org.apache.nifi.cassandra.api.CqlQueryCallback;
24-
import org.apache.nifi.cassandra.api.UpdateMethod;
2523
import org.apache.nifi.security.cert.builder.StandardCertificateBuilder;
2624
import org.apache.nifi.serialization.SimpleRecordSchema;
2725
import org.apache.nifi.serialization.record.MapRecord;
2826
import org.apache.nifi.serialization.record.RecordField;
2927
import org.apache.nifi.serialization.record.RecordFieldType;
3028
import org.apache.nifi.serialization.record.RecordSchema;
31-
import org.apache.nifi.service.mock.MockCassandraProcessor;
29+
import org.apache.nifi.service.cassandra.mock.MockCassandraProcessor;
30+
import org.apache.nifi.service.cql.api.CQLQueryCallback;
31+
import org.apache.nifi.service.cql.api.UpdateMethod;
3232
import org.apache.nifi.util.TestRunner;
3333
import org.apache.nifi.util.TestRunners;
3434
import org.junit.jupiter.api.AfterAll;
@@ -243,7 +243,7 @@ public void testQueryRecord() {
243243
}
244244

245245
List<org.apache.nifi.serialization.record.Record> records = new ArrayList<>();
246-
CqlQueryCallback callback = (rowNumber, result, fields, isExhausted) -> records.add(result);
246+
CQLQueryCallback callback = (rowNumber, result, fields, isExhausted) -> records.add(result);
247247

248248
sessionProvider.query("select * from testspace.query_test", false, null, callback);
249249
}
@@ -277,7 +277,7 @@ private static String getKeyEncoded(final Key key) {
277277
}
278278

279279
private static Path writeCertificateEncoded(final String certificateEncoded) throws IOException {
280-
final Path certificateFile = Files.createTempFile(TestCassandraCQLExecutionServiceV3.class.getSimpleName(), ".crt");
280+
final Path certificateFile = Files.createTempFile(AbstractTestCassandraCQLExecutionService.class.getSimpleName(), ".crt");
281281
Files.write(certificateFile, certificateEncoded.getBytes(StandardCharsets.UTF_8));
282282
certificateFile.toFile().deleteOnExit();
283283
return certificateFile;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.nifi.service;
17+
package org.apache.nifi.service.cassandra;
1818

1919
import org.junit.jupiter.api.BeforeAll;
2020
import org.testcontainers.junit.jupiter.Testcontainers;
2121

2222
@Testcontainers
23-
public class TestCassandraCQLExecutionServiceV3 extends AbstractTestCassandraCQLExecutionService {
23+
public class CassandraCQLExecutionServiceV3IT extends AbstractTestCassandraCQLExecutionService {
2424
public static final String CASSANDRA_IMAGE = "cassandra:3.11";
2525

2626
@BeforeAll
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.nifi.service;
17+
package org.apache.nifi.service.cassandra;
1818

1919
import org.junit.jupiter.api.BeforeAll;
2020
import org.testcontainers.junit.jupiter.Testcontainers;
2121

2222
@Testcontainers
23-
public class TestCassandraCQLExecutionServiceV4 extends AbstractTestCassandraCQLExecutionService {
23+
public class CassandraCQLExecutionServiceV4IT extends AbstractTestCassandraCQLExecutionService {
2424
public static String CASSANDRA_IMAGE = "cassandra:4.1";
2525

2626
@BeforeAll
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.nifi.service;
18+
package org.apache.nifi.service.cassandra;
1919

2020
import org.junit.jupiter.api.BeforeAll;
2121
import org.testcontainers.junit.jupiter.Testcontainers;
2222

2323
@Testcontainers
24-
public class TestCassandraCQLExecutionServiceV5 extends AbstractTestCassandraCQLExecutionService {
24+
public class CassandraCQLExecutionServiceV5IT extends AbstractTestCassandraCQLExecutionService {
2525
public static final String CASSANDRA_IMAGE = "cassandra:5.0";
2626

2727
@BeforeAll

0 commit comments

Comments
 (0)