-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Replace banner.txt with new logo #2738
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ab928e8
Replace banner.txt with new logo
making c3798c9
Update zipkin-server/src/main/resources/banner.txt
making 521caa4
OPENZIPKIN -> ZIPKIN
making 4ca0ae3
Make logo color orange in the banner
making 175a1f4
Merge branch 'master' into patch-1
making d1b56fc
Fix a compile error
making 07f43a8
Rename to ZipkinAnsi256ColorPropertySource
making edebc31
Add TODO comment
making 5cc54c9
Add a link to the PR
making File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
38 changes: 38 additions & 0 deletions
38
zipkin-server/src/main/java/zipkin2/server/internal/banner/ZipkinAnsi256Color.java
This file contains hidden or 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,38 @@ | ||
| /* | ||
| * Copyright 2015-2019 The OpenZipkin Authors | ||
| * | ||
| * Licensed 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 zipkin2.server.internal.banner; | ||
|
|
||
| import org.springframework.boot.ansi.AnsiElement; | ||
|
|
||
| /** | ||
| * <code>AnsiElement</code> implementation for Ansi256 Color<br> | ||
| * TODO: This class should be deleted when this feature is provided by Spring Boot | ||
| * @see <a href="https://github.com/spring-projects/spring-boot/pull/18264">https://github.com/spring-projects/spring-boot/pull/18264</a> | ||
| */ | ||
| public class ZipkinAnsi256Color implements AnsiElement { | ||
|
|
||
| private final int xtermNumber; | ||
|
|
||
| ZipkinAnsi256Color(int xtermNumber) { | ||
| if (xtermNumber < 0 || xtermNumber > 255) { | ||
| throw new IllegalArgumentException("'xtermNumber' must be 0-255!"); | ||
| } | ||
| this.xtermNumber = xtermNumber; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "38;5;" + this.xtermNumber; | ||
| } | ||
| } | ||
46 changes: 46 additions & 0 deletions
46
...server/src/main/java/zipkin2/server/internal/banner/ZipkinAnsi256ColorPropertySource.java
This file contains hidden or 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,46 @@ | ||
| /* | ||
| * Copyright 2015-2019 The OpenZipkin Authors | ||
| * | ||
| * Licensed 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 zipkin2.server.internal.banner; | ||
|
|
||
| import org.springframework.boot.ansi.AnsiElement; | ||
| import org.springframework.boot.ansi.AnsiOutput; | ||
| import org.springframework.core.env.PropertySource; | ||
| import org.springframework.util.StringUtils; | ||
|
|
||
| /** | ||
| * This class enable to use Ansi256 Color in the banner txt file | ||
| * via <code>${ZipkinAnsi256Color.XYZ}</code> format (<code>XYZ</code> must be 0-255.).<br> | ||
| * All supported colors can be found <a href="https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit">here</a>.<br> | ||
| * TODO: This class should be deleted when this feature is provided by Spring Boot | ||
| * @see <a href="https://github.com/spring-projects/spring-boot/pull/18264">https://github.com/spring-projects/spring-boot/pull/18264</a> | ||
| */ | ||
| public class ZipkinAnsi256ColorPropertySource extends PropertySource<AnsiElement> { | ||
|
|
||
| private static final String PREFIX = "ZipkinAnsi256Color."; | ||
|
|
||
| ZipkinAnsi256ColorPropertySource(String name) { | ||
| super(name); | ||
| } | ||
|
|
||
| @Override | ||
| public Object getProperty(String name) { | ||
| if (StringUtils.hasLength(name)) { | ||
| if (name.startsWith(PREFIX)) { | ||
| int xtermNumber = Integer.parseInt(name.substring(PREFIX.length())); | ||
| return AnsiOutput.encode(new ZipkinAnsi256Color(xtermNumber)); | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
zipkin-server/src/main/java/zipkin2/server/internal/banner/ZipkinBanner.java
This file contains hidden or 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,48 @@ | ||
| /* | ||
| * Copyright 2015-2019 The OpenZipkin Authors | ||
| * | ||
| * Licensed 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 zipkin2.server.internal.banner; | ||
|
|
||
| import org.springframework.boot.ResourceBanner; | ||
| import org.springframework.core.env.Environment; | ||
| import org.springframework.core.env.MutablePropertySources; | ||
| import org.springframework.core.env.PropertyResolver; | ||
| import org.springframework.core.env.PropertySourcesPropertyResolver; | ||
| import org.springframework.core.io.ClassPathResource; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * <code>Banner</code> implemetation for Ansi256 Color<br> | ||
| * TODO: This class should be deleted when this feature is provided by Spring Boot | ||
| * @see <a href="https://github.com/spring-projects/spring-boot/pull/18264">https://github.com/spring-projects/spring-boot/pull/18264</a> | ||
| */ | ||
| public class ZipkinBanner extends ResourceBanner { | ||
|
|
||
| public ZipkinBanner() { | ||
| super(new ClassPathResource("zipkin.txt")); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<PropertyResolver> getPropertyResolvers(Environment environment, Class<?> sourceClass) { | ||
| final List<PropertyResolver> propertyResolvers = super.getPropertyResolvers(environment, sourceClass); | ||
| propertyResolvers.add(getZipkinAnsi256Resolver()); | ||
| return propertyResolvers; | ||
| } | ||
|
|
||
| private PropertyResolver getZipkinAnsi256Resolver() { | ||
| MutablePropertySources sources = new MutablePropertySources(); | ||
| sources.addFirst(new ZipkinAnsi256ColorPropertySource("zipkinAnsi256")); | ||
| return new PropertySourcesPropertyResolver(sources); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,28 @@ | ||
| ${ZipkinAnsi256Color.208} | ||
| oo | ||
| oooo | ||
| oooooo | ||
| oooooooo | ||
| oooooooooo | ||
| oooooooooooo | ||
| ooooooo ooooooo | ||
| oooooo ooooooo | ||
| oooooo ooooooo | ||
| oooooo o o oooooo | ||
| oooooo oo oo oooooo | ||
| ooooooo oooo oooo ooooooo | ||
| oooooo ooooo ooooo ooooooo | ||
| oooooo oooooo oooooo ooooooo | ||
| oooooooo oo oo oooooooo | ||
| ooooooooooooo oo oo ooooooooooooo | ||
| oooooooooooo oooooooooooo | ||
| oooooooo oooooooo | ||
| oooo oooo | ||
| ${AnsiStyle.NORMAL} | ||
| ________ ____ _ _____ _ _ | ||
| |__ /_ _| _ \| |/ /_ _| \ | | | ||
| / / | || |_) | ' / | || \| | | ||
| / /_ | || __/| . \ | || |\ | | ||
| |____|___|_| |_|\_\___|_| \_| | ||
|
|
||
| ${AnsiColor.GREEN}:: Powered by Spring Boot :: ${AnsiStyle.FAINT}${AnsiColor.BLACK}${spring-boot.formatted-version}${AnsiStyle.NORMAL} |
48 changes: 48 additions & 0 deletions
48
...er/src/test/java/zipkin2/server/internal/banner/ZipkinAnsi256ColorPropertySourceTest.java
This file contains hidden or 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,48 @@ | ||
| /* | ||
| * Copyright 2015-2019 The OpenZipkin Authors | ||
| * | ||
| * Licensed 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 zipkin2.server.internal.banner; | ||
|
|
||
| import org.junit.After; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
| import org.springframework.boot.ansi.AnsiOutput; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| public class ZipkinAnsi256ColorPropertySourceTest { | ||
|
|
||
| @Before | ||
| public void setUp() throws Exception { | ||
| AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS); | ||
| } | ||
|
|
||
| @After | ||
| public void tearDown() throws Exception { | ||
| AnsiOutput.setEnabled(AnsiOutput.Enabled.DETECT); | ||
| } | ||
|
|
||
| @Test | ||
| public void getPropertyFoundShouldConvertAnsiColor() { | ||
| final ZipkinAnsi256ColorPropertySource propertySource = new ZipkinAnsi256ColorPropertySource("test"); | ||
| final Object property = propertySource.getProperty("ZipkinAnsi256Color.100"); | ||
| assertThat(property).isEqualTo("\033[38;5;100m"); | ||
| } | ||
|
|
||
| @Test | ||
| public void getPropertyNotFoundShouldReturnNull() { | ||
| final ZipkinAnsi256ColorPropertySource propertySource = new ZipkinAnsi256ColorPropertySource("test"); | ||
| final Object property = propertySource.getProperty("foo"); | ||
| assertThat(property).isNull(); | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
zipkin-server/src/test/java/zipkin2/server/internal/banner/ZipkinAnsi256ColorTest.java
This file contains hidden or 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,38 @@ | ||
| /* | ||
| * Copyright 2015-2019 The OpenZipkin Authors | ||
| * | ||
| * Licensed 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 zipkin2.server.internal.banner; | ||
|
|
||
| import org.junit.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; | ||
|
|
||
| public class ZipkinAnsi256ColorTest { | ||
|
|
||
| @Test | ||
| public void testToString() { | ||
| final ZipkinAnsi256Color ansi256Color = new ZipkinAnsi256Color(208); | ||
| assertThat(ansi256Color.toString()).isEqualTo("38;5;208"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testIllegalXtermNumber() { | ||
| try { | ||
| new ZipkinAnsi256Color(256); | ||
| failBecauseExceptionWasNotThrown(IllegalArgumentException.class); | ||
| } catch (IllegalArgumentException e) { | ||
| assertThat(e.getMessage()).isEqualTo("'xtermNumber' must be 0-255!"); | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a TODO to delete on spring boot 2.2 if that's when this is scheduled to be normally possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in edebc31