[ 
https://issues.apache.org/jira/browse/NIFI-14225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17924199#comment-17924199
 ] 

Daniel Stieglitz edited comment on NIFI-14225 at 2/5/25 9:14 PM:
-----------------------------------------------------------------

Looking at the GenericContainer 
[javadoc|https://javadoc.io/static/org.testcontainers/testcontainers/1.20.4/org/testcontainers/containers/GenericContainer.html#addFixedExposedPort]
 there is method addFixedExposedPort but its protected and the javadoc there 
explains why
{quote}Add a container port that should be bound to a fixed port on the docker 
host.

Note that this method is protected scope to discourage use, as clashes or 
instability are more likely when using fixed port mappings. If you need to use 
this method from a test, please use 
[{{FixedHostPortGenericContainer}}|https://javadoc.io/static/org.testcontainers/testcontainers/1.20.4/org/testcontainers/containers/FixedHostPortGenericContainer.html]
 instead of GenericContainer.
{quote}
So it seems circular on the one hand they say to use 
FixedHostPortGenericContainer and on the other hand they deprecate it which 
would seem they discourage its use.


was (Author: JIRAUSER294662):
Looking at the GenericContainer 
[javadoc|https://javadoc.io/static/org.testcontainers/testcontainers/1.20.4/org/testcontainers/containers/GenericContainer.html#addFixedExposedPort]
 there is method addFixedExposedPort but its protected and the javadoc there 
explains why

{quote}

Add a container port that should be bound to a fixed port on the docker host.

Note that this method is protected scope to discourage use, as clashes or 
instability are more likely when using fixed port mappings. If you need to use 
this method from a test, please use 
[{{FixedHostPortGenericContainer}}|https://javadoc.io/static/org.testcontainers/testcontainers/1.20.4/org/testcontainers/containers/FixedHostPortGenericContainer.html]
 instead of GenericContainer.

{quote}

So it seems circular on the one hand they say to use it and on the other hand 
they deprecate it.

> Replace deprecated methods in testcontainers with suggested replacements
> ------------------------------------------------------------------------
>
>                 Key: NIFI-14225
>                 URL: https://issues.apache.org/jira/browse/NIFI-14225
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Minor
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> There are many warnings when building regarding various test container 
> deprecations as seen in the messages below. The aim of this ticket is to use 
> the current API suggested replacements in order not to get these warnings. 
> {code:java}
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/s
> ervices/smb/SmbjClientServiceIT.java:[93,8] [deprecation] ContainerProxy in 
> ToxiproxyContainer has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-smbj-client/src/test/java/org/apache/nifi/s
> ervices/smb/SmbjClientServiceIT.java:[93,45] [deprecation] 
> getProxy(String,int) in ToxiproxyContainer has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/test/java/org/apache/nifi/pr
> ocessors/smb/SmbDfsIT.java:[59,55] [deprecation] 
> <SELF>FixedHostPortGenericContainer(String) in FixedHostPortGenericContainer 
> has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-service/src/test/java/org/apache/nifi
> /kafka/service/Kafka3ConnectionServiceBaseIT.java:[137,12] [deprecation] 
> KafkaContainer in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-service/src/test/java/org/apache/nifi
> /kafka/service/Kafka3ConnectionServiceBaseIT.java:[164,29] [deprecation] 
> KafkaContainer in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-service/src/test/java/org/apache/nifi
> /kafka/service/KafkaConnectivityIT.java:[53,19] [deprecation] KafkaContainer 
> in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-service/src/test/java/org/apache/nifi
> /kafka/service/KafkaConnectivityIT.java:[57,20] [deprecation] KafkaContainer 
> in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/
> nifi/kafka/processors/AbstractKafkaBaseIT.java:[47,27] [deprecation] 
> KafkaContainer in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/
> nifi/kafka/processors/AbstractKafkaBaseIT.java:[51,29] [deprecation] 
> KafkaContainer in org.testcontainers.containers has been deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/
> nifi/kafka/processors/PublishKafkaAuthSaslPlaintextIT.java:[64,19] 
> [deprecation] KafkaContainer in org.testcontainers.containers has been 
> deprecated
> [WARNING] 
> nifi-2.2.0/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/
> nifi/kafka/processors/PublishKafkaAuthSaslPlaintextIT.java:[68,20] 
> [deprecation] KafkaContainer in org.testcontainers.containers has been 
> deprecated
> nifi/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/test/java/org/apache/
> nifi/redis/testcontainers/RedisContainer.java:[104,8] [deprecation] 
> addFileSystemBind(String,String,BindMode) in Container has been
>  deprecated{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to