Skip to content

Conversation

@Umadevi-Kapu
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.3%) to 44.943% when pulling 8788ebe on xumakap:links into eca019d on Ericsson:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.3%) to 44.932% when pulling 194c969 on xumakap:links into eca019d on Ericsson:master.

/**
* This class is used to read required and optional links from linksValidation.properties file
*
* @author xumakap

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove author

public static List<String> getRequiredLinks(String eventType) {

if (requiredLinksMap.size() == 0 || optionalLinksMap.size() == 0) {
while (keys.hasMoreElements()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why iterating map, Use directly get from Map


if(requiredLinks == null && optionalLinks == null) {
throw new EiffelValidationException(eiffelType.getEventName()+"event links not configured in property file "+CONFIG_FILE);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if may be some of event does not have optional parameters then?

throw new EiffelValidationException(message, e);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

public void linksValidation(EiffelEventType eiffelType, JsonObject jsonObject) throws EiffelValidationException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are validating only Links Object, So do not pass entire event object.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.3%) to 44.947% when pulling 8a75435 on xumakap:links into eca019d on Ericsson:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.5%) to 46.201% when pulling ab67952 on xumakap:links into eca019d on Ericsson:master.

@xdurvak xdurvak requested a review from SantoshNC68 August 8, 2017 13:41

String getEventName() {
public String getEventName() {
return id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name from id to eventName


import com.ericsson.eiffel.remrem.semantics.schemas.EiffelConstants;

public enum LinkTypes {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkTypes to LinkType

private final String OPTIONAL_LINKS = "optionalLinks";
private final String DOT = ".";

public LinksConfiguration() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadoc for the constructor

}
return idMap.get(id);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc for the method

package com.ericsson.eiffel.remrem.semantics;

import com.ericsson.eiffel.remrem.semantics.schemas.EiffelConstants;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadoc for the Enum

* This method is used to get all link types from LinkTypes Enum
* @return link types list
*/
public List<String> getLinkTypes() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAllLinkTypes


public class EiffelOutputValidatorFactory {

private static LinksConfiguration linksConfiguration = new LinksConfiguration();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final keyword

private List<String> linkTypes;

public EiffelValidator(String schemaResourceName) {
public EiffelValidator(String schemaResourceName, String eventType, List<String> requiredLinks, List<String> optionalLinks, List<String> linkTypes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requiredLinkTypes, optionalLinkTypes, allLinkTypes

}
/**
* This method is used to validate links in an event
* @param eiffelType is an event type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove javadoc

public OutputValidator(String schemaResourceName) {
super(schemaResourceName);
public OutputValidator(String schemaResourceName,String eventType, List<String> requiredLinks, List<String> optionalLinks, List<String> linkTypes) {
super(schemaResourceName, eventType, requiredLinks, optionalLinks, linkTypes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allLinkTypes

for (String requiredLink : requiredLinks) {
Integer count = linksCountMapForEvent.get(requiredLink);
if (count == null) {
throw new EiffelValidationException("Mandatory links missing");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Link type to EiffelValidationException

@coveralls
Copy link

Coverage Status

Coverage increased (+2.4%) to 46.111% when pulling f56a832 on xumakap:links into eca019d on Ericsson:master.

} catch (MissingResourceException e) {
return linkTypeList;
}
}*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove not needed code

return getLinkTypesFromConfiguration(key);
}

/*private List<String> getLinkTypesFromConfiguration(String key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

return getLinkTypesFromConfiguration(key);
}

private List<String> getLinkTypesFromConfiguration(String key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add java doc

@coveralls
Copy link

Coverage Status

Coverage increased (+2.4%) to 46.111% when pulling 9b7a371 on xumakap:links into eca019d on Ericsson:master.

@xvinosi-github
Copy link
Contributor

+1

}
Set<String> linksSet = new HashSet<>(linksCountMapForEvent.keySet());

for (String requiredLinkType : requiredLinkTypes) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use java8 Lambda Expression

String CONTEXT_LINK = "CONTEXT";
try {
JsonArray links = jsonObjectInput.get("links").getAsJsonArray();
for (JsonElement link : links) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use java 8 Lambda Expression, we can reduce this logic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can implement then in upcoming stories related to this.

throw new EiffelValidationException(
"Link types " + CAUSE_LINK + " and " + CONTEXT_LINK + " should not be in one event");
}
for (String optionalLinkType : optionalLinkTypes) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use java 8 Lambda Expression

Copy link
Member

@SantoshNC68 SantoshNC68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please implement the lambda expressions in coming tasks.

@Umadevi-Kapu Umadevi-Kapu merged commit 329494c into eiffel-community:master Aug 11, 2017
@Umadevi-Kapu Umadevi-Kapu deleted the links branch August 29, 2017 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants