Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from Testcontainers oracle-xe module to oracle-free #435

Open
eddumelendez opened this issue Nov 28, 2023 · 3 comments
Open

Move from Testcontainers oracle-xe module to oracle-free #435

eddumelendez opened this issue Nov 28, 2023 · 3 comments
Labels
good first issue Good for newcomers recipe Recipe request testcontainers

Comments

@eddumelendez
Copy link
Collaborator

eddumelendez commented Nov 28, 2023

What problem are you trying to solve?

Oracle Database Free is the successor of Oracle XE

What precondition(s) should be checked before applying this recipe?

  • Testcontainers version should be >= 1.19.2
  • org.testcontainers:oracle-xe dependency should change to org.testcontainers:oracle-free
  • org.testcontainers.containers.OracleContainer is used

Describe the situation before applying the recipe

import org.testcontainers.containers.OracleContainer;

class A {
    void foo() {
        var dockerImageName = DockerImageName.parse("gvenzl/oracle-free:23.3-slim-faststart").asCompatibleSubstituteFor("gvenzl/oracle-xe")
        OracleContainer oracle = new OracleContainer(dockerImageName);
    }
}

Describe the situation after applying the recipe

import org.testcontainers.oracle.OracleContainer;

class A {
    void foo() {
        OracleContainer oracle = new OracleContainer("gvenzl/oracle-free:23.3-slim-faststart");
    }
}

Have you considered any alternatives or workarounds?

Any additional context

OracleContainer from oracle-xe module depends on gvenzl/oracle-xe image. Meanwhile, OracleContainer from oracle-free module depends on gvenzl/oracle-free.

We can check if

Are you interested in contributing this recipe to OpenRewrite?

@timtebeek timtebeek added the good first issue Good for newcomers label Nov 28, 2023
@timtebeek
Copy link
Contributor

This is likely all you need, as composed through our recipe builder

type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.testcontainers.MigrateToOracleFree
displayName: Migrate from `oracle-xe` to `oracle-free`
description: Oracle Database Free is the successor of Oracle XE.
recipeList:
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: org.testcontainers.containers.OracleContainer
      newFullyQualifiedTypeName: org.testcontainers.oracle.OracleContainer
  - org.openrewrite.java.dependencies.ChangeDependency:
      oldGroupId: org.testcontainers
      oldArtifactId: oracle-xe
      newArtifactId: oracle-free
      versionPattern: 1.19.x

@timtebeek
Copy link
Contributor

All you then need is some tests to verify it works, using the before/after above, and you should be good to go.

@eddumelendez
Copy link
Collaborator Author

I've updated the PR description because the image also change but we can still apply the recipe if DockerImageName.parse("gvenzl/oracle-free:23.3-slim-faststart").asCompatibleSubstituteFor("gvenzl/oracle-xe") has been declared. Thanks @timtebeek! I was expecting to use it as you described :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers recipe Recipe request testcontainers
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants