-
Notifications
You must be signed in to change notification settings - Fork 826
[SCB-171] report type/version when register to SC #460
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
Conversation
try { | ||
prop.load(in); | ||
} catch (Exception e) { | ||
e.printStackTrace(); |
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.
Please log the error and throw the exception out.
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.
Instead of using mavenVersionFor
public void testInitializedValues() { | ||
initFramework(); //Initialize the Values | ||
Assert.assertEquals("JAVA-CHASSIS", framework.getName()); | ||
Assert.assertEquals("0.6.0", framework.getVersion()); |
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.
Do we need to change the version once we release java-chassis 0.6.0?
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.
yes
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.
please make it automatically.
@@ -0,0 +1 @@ | |||
FRAMEWORK_VERSION=0.6.0 No newline at end of file |
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.
How about change the version to xxx-test?
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.
The new modification deletes this file,replace with pom.properties
/** | ||
* Created by on 2017/12/22. | ||
*/ | ||
public class GetFrameworkVersionFromXml { |
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.
xml???
properties?
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.
done
} | ||
|
||
private static void loadProperties() { | ||
InputStream in = |
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.
no need to close inputStream?
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.
replace with mavenVersionFor
* Created by on 2017/12/22. | ||
*/ | ||
public class GetFrameworkVersionFromXml { | ||
private static Properties prop; |
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.
why need this field?
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.
done
|
||
private static void loadProperties() { | ||
InputStream in = | ||
GetFrameworkVersionFromXml.class.getResourceAsStream("/config/frameworkVersion.properties"); |
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.
found that maven will put \META-INF\maven{groupId}{artifactId}\pom.properties and pom.xml into jar automatically
we no need to create a new properties.
you can read code: com.fasterxml.jackson.core.util.VersionUtil.mavenVersionFor(ClassLoader, String, String)
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.
done
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.
i did not find the confirm: will we use ServiceComb or cse version?
have i missed some information?
@@ -0,0 +1,3 @@ | |||
groupId=io.servicecomb |
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.
why we need this file ?
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.
in mavenVersionFor's source code,it need to read pom.properties,
public static Version mavenVersionFor(ClassLoader classLoader, String groupId, String artifactId) {
InputStream pomPoperties = classLoader.getResourceAsStream("META-INF/maven/" +
groupId.replaceAll("\.", "/") + "/" + artifactId + "/pom.properties");
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.
i remember this file will be generated automatically.
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.
yes,when mvn package,this file will be generated automatically, i'll delete it
After discussion, use ServiceComb version |
pom.xml
Outdated
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<resources> |
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.
what's this?
to generate pom.properties?
it seems that no need to do this.
|
||
public class TestGetFrameworkVersion { | ||
|
||
ClassLoader classLoader = null; |
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.
what's the field purpose?
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.
delete it now
@Test | ||
public void test() { | ||
@SuppressWarnings("deprecation") | ||
Version version = VersionUtil.mavenVersionFor(classLoader, "io.servicecomb", "java-chassis"); |
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.
your test target is "GetFrameworkVersion"
but where is your target instance?
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.
done,GetFrameworkVersion have been deleted
/** | ||
* Created by on 2017/12/22. | ||
*/ | ||
public class GetFrameworkVersion { |
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.
your class name is getXXXX????
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.
done,delete it now,use default value first
private Framework framework; | ||
|
||
@JsonProperty(value = "registerBy") | ||
private String registeredBy; |
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.
use the original name
i remember wrote comment, class Microservice not only describe self, but also describe others
why did not do any response?
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.
done
|
||
public class TestFramework { | ||
|
||
Framework framework = null; |
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.
do you think 27~37 equals
Framework framework = new Framework();
|
||
public static final String GROUPID = "io.servicecomb"; | ||
|
||
public static final String ARTIFACTID = "java-chassis"; |
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.
are you sure you can read version by this artifactid?
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.
when mvn package, the version can be read,
maybe this is simpler and not depend on jackson Deprecated method:
but you need to do more test at least include: |
|
||
String CONFIG_FRAMEWORK_DEFAULT_NAME = "servicecomb-java-chassis"; | ||
|
||
String CONFIG_FRAMEWORK_DEFAULT_VERSION = "1.0"; |
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.
fake "1.0" is not good
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.
set version to empty now
Follow this checklist to help us incorporate your contribution quickly and easily:
[JAV-XXX] Fixes bug in ApproximateQuantiles
, where you replaceJAV-XXX
with the appropriate JIRA issue.mvn clean install
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.1、SDK report their framework type and version when register to SC
2、Each service with specific version has a certain framework+version
3、Present the type/version information in console in Service+Version level
4、In gov service, send the different command to CC according to the type/version when doing
management