forked from fabric8io/fabric8-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : Add Fabric8 Maven Plugin deprecation log message before & afte…
…r goal executions Related to eclipse-jkube/jkube#1426 Add warning log message to print deprecation message and instruct users to migrate to Eclipse JKube Signed-off-by: Rohan Kumar <rohaan@redhat.com>
- Loading branch information
1 parent
2631458
commit 43e2dfe
Showing
7 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
core/src/main/java/io/fabric8/maven/core/util/Fabric8MavenPluginDeprecationUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2016 Red Hat, Inc. | ||
* | ||
* Red Hat licenses this file to you under the Apache License, version | ||
* 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package io.fabric8.maven.core.util; | ||
|
||
import io.fabric8.maven.docker.util.Logger; | ||
|
||
public class Fabric8MavenPluginDeprecationUtil { | ||
private Fabric8MavenPluginDeprecationUtil() { } | ||
|
||
public static void logFabric8MavenPluginDeprecation(Logger logger, boolean logDeprecationWarning) { | ||
if (logDeprecationWarning) { | ||
logger.warn("Fabric8 Maven Plugin has been deprecated and is no longer supported.\n\n" + | ||
"Please consider migrating to Eclipse JKube (https://github.com/eclipse/jkube) plugins:\n" + | ||
" - Kubernetes Maven Plugin (https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin)\n" + | ||
" - OpenShift Maven Plugin (https://www.eclipse.org/jkube/docs/openshift-maven-plugin/)\n" + | ||
"You can read the Migration Guide for more details (https://www.eclipse.org/jkube/docs/migration-guide/)\n\n" + | ||
"Note: To disable this warning use `-Dfabric8.logDeprecationWarning=false`."); | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
core/src/test/java/io/fabric8/maven/core/util/Fabric8MavenPluginDeprecationUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright 2016 Red Hat, Inc. | ||
* | ||
* Red Hat licenses this file to you under the Apache License, version | ||
* 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package io.fabric8.maven.core.util; | ||
|
||
import io.fabric8.maven.docker.util.Logger; | ||
import mockit.Mocked; | ||
import mockit.Verifications; | ||
import org.junit.Test; | ||
|
||
public class Fabric8MavenPluginDeprecationUtilTest { | ||
@Mocked | ||
private Logger logger; | ||
|
||
@Test | ||
public void logFabric8MavenPluginDeprecation_whenLogDeprecationTrue_shouldLogDeprecationWarning() { | ||
// Given + When | ||
Fabric8MavenPluginDeprecationUtil.logFabric8MavenPluginDeprecation(logger, true); | ||
|
||
// Then | ||
new Verifications() {{ | ||
logger.warn("Fabric8 Maven Plugin has been deprecated and is no longer supported.\n\n" + | ||
"Please consider migrating to Eclipse JKube (https://github.com/eclipse/jkube) plugins:\n" + | ||
" - Kubernetes Maven Plugin (https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin)\n" + | ||
" - OpenShift Maven Plugin (https://www.eclipse.org/jkube/docs/openshift-maven-plugin/)\n" + | ||
"You can read the Migration Guide for more details (https://www.eclipse.org/jkube/docs/migration-guide/)\n\n" + | ||
"Note: To disable this warning use `-Dfabric8.logDeprecationWarning=false`."); | ||
times = 1; | ||
}}; | ||
} | ||
|
||
@Test | ||
public void logFabric8MavenPluginDeprecation_whenLogDeprecationFalse_shouldLogDeprecationWarning() { | ||
// Given + When | ||
Fabric8MavenPluginDeprecationUtil.logFabric8MavenPluginDeprecation(logger, false); | ||
|
||
// Then | ||
new Verifications() {{ | ||
logger.warn(anyString); | ||
times = 0; | ||
}}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters