Skip to content

Commit

Permalink
Merge branch 'development' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongilbert123 committed Sep 20, 2018
2 parents 3780441 + 108a620 commit 749081a
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 34 deletions.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at devex@relativity.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
87 changes: 84 additions & 3 deletions Gravity/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ csharp_style_expression_bodied_methods = when_on_single_line:suggestion
#prefer out variables to be declared inline in the argument list of a method call when possible
csharp_style_inlined_variable_declaration = true:suggestion
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_predefined_type_for_member_access = true:warning

#Style - implicit and explicit types

Expand All @@ -70,7 +70,7 @@ csharp_style_var_when_type_is_apparent = true:suggestion
#Style - language keyword and framework type options

#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:warning

#Style - qualification options

Expand All @@ -80,4 +80,85 @@ dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_event = false:suggestion


# NAMING CONVENTIONS

#Classes, Interfaces: Pascal
dotnet_naming_rule.types.severity = warning
dotnet_naming_rule.types.symbols = types_def
dotnet_naming_rule.types.style = types_style

dotnet_naming_symbols.types_def.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types_def.applicable_accessibilities = *

dotnet_naming_style.types_style.capitalization = pascal_case

#Methods: Pascal
dotnet_naming_rule.methods.severity = warning
dotnet_naming_rule.methods.symbols = methods_def
dotnet_naming_rule.methods.style = methods_style

dotnet_naming_symbols.methods_def.applicable_kinds = method
dotnet_naming_symbols.methods_def.applicable_accessibilities = *

dotnet_naming_style.methods_style.capitalization = pascal_case

#Local variables: Camel
dotnet_naming_rule.locals.severity = warning
dotnet_naming_rule.locals.symbols = locals_def
dotnet_naming_rule.locals.style = locals_style

dotnet_naming_symbols.locals_def.applicable_kinds = local, local_function

dotnet_naming_style.locals_style.capitalization = camel_case

#Method argumens: Camel
dotnet_naming_rule.method_arguments.severity = warning
dotnet_naming_rule.method_arguments.symbols = method_arguments_def
dotnet_naming_rule.method_arguments.style = method_arguments_style

dotnet_naming_symbols.method_arguments_def.applicable_kinds = parameter

dotnet_naming_style.method_arguments_style.capitalization = camel_case

#private member variables: camel, underscore prefix

dotnet_naming_rule.private_member_variables.severity = warning
dotnet_naming_rule.private_member_variables.symbols = private_member_variables_def
dotnet_naming_rule.private_member_variables.style = private_member_variables_style

dotnet_naming_symbols.private_member_variables_def.applicable_kinds = field, delegate, event
dotnet_naming_symbols.private_member_variables_def.applicable_accessibilities = private

dotnet_naming_style.private_member_variables_style.capitalization = camel_case
dotnet_naming_style.private_member_variables_style.required_prefix = _

#private constants: All caps, underscore-seperated, underscore-prefix

dotnet_naming_rule.private_constants.severity = warning
dotnet_naming_rule.private_constants.symbols = private_constants_def
dotnet_naming_rule.private_constants.style = private_constants_style

dotnet_naming_symbols.private_constants_def.applicable_kinds = field
dotnet_naming_symbols.private_constants_def.applicable_accessibilities = private
dotnet_naming_symbols.private_constants_def.required_modifiers = const

dotnet_naming_style.private_constants_style.capitalization = all_upper
dotnet_naming_style.private_constants_style.word_separator = _
dotnet_naming_style.private_constants_style.required_prefix = _


#Non-private Constants: All caps, underscore-seperated, no prefix

dotnet_naming_rule.non_private_constants.severity = warning
dotnet_naming_rule.non_private_constants.symbols = non_private_constants_def
dotnet_naming_rule.non_private_constants.style = non_private_constants_style

dotnet_naming_symbols.non_private_constants_def.applicable_kinds = field
dotnet_naming_symbols.non_private_constants_def.applicable_accessibilities = public, protected, internal
dotnet_naming_symbols.non_private_constants_def.required_modifiers = const

dotnet_naming_style.non_private_constants_style.capitalization = all_upper
dotnet_naming_style.non_private_constants_style.word_separator = _
2 changes: 1 addition & 1 deletion Gravity/Gravity.Test.Unit/RsapiDaoDeleteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ private void SetupQuery<T>(int parentArtifactId, int[] resultArtifactIds) where
}

private void ExecuteDelete(ObjectFieldsDepthLevel depthLevel)
=> new RsapiDao(mockProvider.Object).Delete<GravityLevelOne>(rootId, depthLevel);
=> new RsapiDao(mockProvider.Object, null).Delete<GravityLevelOne>(rootId, depthLevel);
}
}
26 changes: 13 additions & 13 deletions Gravity/Gravity.Test.Unit/RsapiDaoGetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class RsapiDaoGetTests
[Test]
public void Get_BlankRDO()
{
var dao = new RsapiDao(GetChoiceRsapiProvider(null, null));
var dao = new RsapiDao(GetChoiceRsapiProvider(null, null), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
Assert.AreEqual(RootArtifactID, dto.ArtifactId);
}
Expand All @@ -35,7 +35,7 @@ public void Get_MultiObject_FirstLevelOnly()
//test MultiObject fields with one level of recursion
int[] multiObjectIds = new int[] { 1 , 2 , 3 };
int[] singleObjectLevel3ArtifactIds = new int[] { 5 , 6 , 7 };
var dao = new RsapiDao(GetMultipleObjectRsapiProvider(multiObjectIds, singleObjectLevel3ArtifactIds));
var dao = new RsapiDao(GetMultipleObjectRsapiProvider(multiObjectIds, singleObjectLevel3ArtifactIds), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
for(int i = 0; i < multiObjectIds.Length; i++)
{
Expand All @@ -50,7 +50,7 @@ public void Get_MultiObject_Recursive()
//test MultiObject fields with varying degrees of recursion
int[] multiObjectIds = new int[] { 1, 2, 3 };
int[] singleObjectLevel3ArtifactIds = new int[] { 5 , 6 , 7 };
var dao = new RsapiDao(GetMultipleObjectRsapiProvider(multiObjectIds, singleObjectLevel3ArtifactIds));
var dao = new RsapiDao(GetMultipleObjectRsapiProvider(multiObjectIds, singleObjectLevel3ArtifactIds), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FullyRecursive);
for (int i = 0; i < multiObjectIds.Length; i++)
{
Expand All @@ -66,7 +66,7 @@ public void Get_ChildObjectList_FirstLevelOnly()
int level2ChildObjectId = 1;
int singleObjectLevel3Id = 2;
int level3ChildObjectId = 3;
var dao = new RsapiDao(GetChildObjectRsapiProvider(level2ChildObjectId, singleObjectLevel3Id, level3ChildObjectId));
var dao = new RsapiDao(GetChildObjectRsapiProvider(level2ChildObjectId, singleObjectLevel3Id, level3ChildObjectId), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
Assert.AreEqual(level2ChildObjectId, dto.GravityLevel2Childs[0].ArtifactId);
Assert.IsNull(dto.GravityLevel2Childs[0].GravityLevel3Obj);
Expand All @@ -80,7 +80,7 @@ public void Get_ChildObjectList_Recursive()
int level2ChildObjectId = 1;
int singleObjectLevel3Id = 2;
int level3ChildObjectId = 3;
var dao = new RsapiDao(GetChildObjectRsapiProvider(level2ChildObjectId, singleObjectLevel3Id, level3ChildObjectId));
var dao = new RsapiDao(GetChildObjectRsapiProvider(level2ChildObjectId, singleObjectLevel3Id, level3ChildObjectId), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FullyRecursive);
Assert.AreEqual(level2ChildObjectId, dto.GravityLevel2Childs[0].ArtifactId);
Assert.AreEqual(singleObjectLevel3Id, dto.GravityLevel2Childs[0].GravityLevel3Obj.ArtifactId);
Expand All @@ -93,7 +93,7 @@ public void Get_SingleObject_FirstLevelOnly()
//test single object fields with one level of recursion
int singleObjectLevel2ArtifactId = 1;
int singleObjectLevel3ArtifactId = 2;
var dao = new RsapiDao(GetObjectRsapiProvider(singleObjectLevel2ArtifactId, singleObjectLevel3ArtifactId));
var dao = new RsapiDao(GetObjectRsapiProvider(singleObjectLevel2ArtifactId, singleObjectLevel3ArtifactId), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
Assert.AreEqual(singleObjectLevel2ArtifactId, dto.GravityLevel2Obj.ArtifactId);
Assert.IsNull(dto.GravityLevel2Obj.GravityLevel3SingleObj);
Expand All @@ -105,7 +105,7 @@ public void Get_SingleObject_Recursive()
//test single object fields with varying degrees of recursion
int singleObjectLevel2ArtifactId = 25;
int singleObjectLevel3ArtifactId = 26;
var dao = new RsapiDao(GetObjectRsapiProvider(singleObjectLevel2ArtifactId, singleObjectLevel3ArtifactId));
var dao = new RsapiDao(GetObjectRsapiProvider(singleObjectLevel2ArtifactId, singleObjectLevel3ArtifactId), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FullyRecursive);
Assert.AreEqual(singleObjectLevel2ArtifactId, dto.GravityLevel2Obj.ArtifactId);
Assert.AreEqual(singleObjectLevel3ArtifactId, dto.GravityLevel2Obj.GravityLevel3SingleObj.ArtifactId);
Expand All @@ -116,7 +116,7 @@ public void Get_DownloadsFileContents()
{
var fileArray = new byte[] { 2 };
var fileName = "filename.dat";
var dao = new RsapiDao(GetFileRsapiProvider(fileName, fileArray));
var dao = new RsapiDao(GetFileRsapiProvider(fileName, fileArray), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.OnlyParentObject);
CollectionAssert.AreEqual(fileArray, ((ByteArrayFileDto)dto.FileField).ByteArray);
Assert.AreEqual(fileName, ((ByteArrayFileDto)dto.FileField).FileName);
Expand All @@ -125,30 +125,30 @@ public void Get_DownloadsFileContents()
[Test]
public void Get_SkipsDownloadIfNoFile()
{
var dao = new RsapiDao(GetFileRsapiProvider(null, null));
var dao = new RsapiDao(GetFileRsapiProvider(null, null), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.OnlyParentObject);
Assert.Null(dto.FileField);
}

[Test]
public void Get_SingleChoice_InEnum()
{
var dao = new RsapiDao(GetChoiceRsapiProvider(2, null));
var dao = new RsapiDao(GetChoiceRsapiProvider(2, null), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
Assert.AreEqual(SingleChoiceFieldChoices.SingleChoice2, dto.SingleChoice);
}

[Test]
public void Get_SingleChoice_NotInEnum()
{
var dao = new RsapiDao(GetChoiceRsapiProvider(5, null));
var dao = new RsapiDao(GetChoiceRsapiProvider(5, null), null);
Assert.Throws<InvalidOperationException>(() => dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly));
}

[Test]
public void Get_MultipleChoice_AllInEnum()
{
var dao = new RsapiDao(GetChoiceRsapiProvider(null, new[] { 11, 13 }));
var dao = new RsapiDao(GetChoiceRsapiProvider(null, new[] { 11, 13 }), null);
var dto = dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly);
CollectionAssert.AreEquivalent(
new[] { MultipleChoiceFieldChoices.MultipleChoice1, MultipleChoiceFieldChoices.MultipleChoice3 },
Expand All @@ -160,7 +160,7 @@ public void Get_MultipleChoice_AllInEnum()
public void Get_MultipleChoice_NotAllInEnum()
{
//first item is in an enum, but not in our enum
var dao = new RsapiDao(GetChoiceRsapiProvider(null, new[] { 3, 13 }));
var dao = new RsapiDao(GetChoiceRsapiProvider(null, new[] { 3, 13 }), null);
Assert.Throws<InvalidOperationException>(() => dao.Get<GravityLevelOne>(RootArtifactID, Base.ObjectFieldsDepthLevel.FirstLevelOnly));

}
Expand Down
2 changes: 1 addition & 1 deletion Gravity/Gravity.Test.Unit/RsapiDaoInsertTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void Insert_ChildObject_NonRecursive()
void InsertObject(G1 objectToInsert, RdoCondition rootCondition, ObjectFieldsDepthLevel depthLevel)
{
SetupInsertManyCondition(x => x.Count == 1 && rootCondition(x.Single()), 10);
var insertedId = new RsapiDao(mockProvider.Object).Insert(objectToInsert, depthLevel);
var insertedId = new RsapiDao(mockProvider.Object, null).Insert(objectToInsert, depthLevel);
Assert.AreEqual(10, insertedId);
Assert.AreEqual(10, objectToInsert.ArtifactId);
}
Expand Down
2 changes: 1 addition & 1 deletion Gravity/Gravity.Test.Unit/RsapiDaoUpdateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void UpdateObject(G1 objectToUpdate, RdoBoolCond rootExpression, ObjectFieldsDep
.Returns(new[] { new RDO(FileFieldId) }.ToSuccessResultSet<WriteResultSet<RDO>>());
mockProvider.Setup(x => x.ClearFile(FileFieldId, G1ArtifactId));

new RsapiDao(mockProvider.Object).Update(objectToUpdate, depthLevel);
new RsapiDao(mockProvider.Object, null).Update(objectToUpdate, depthLevel);
}

private void SetupSingleObjectQuery(params int[] resultArtifactIds)
Expand Down
7 changes: 4 additions & 3 deletions Gravity/Gravity/DAL/RSAPI/RsapiDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ public RsapiDao(IServicesMgr servicesManager, int workspaceId, ExecutionIdentity
private RsapiDao(IServicesMgr servicesManager, int workspaceId, ExecutionIdentity executionIdentity,
InvokeWithRetryService invokeWithRetryService,
int batchSize = DefaultBatchSize)
: this(new RsapiProvider(servicesManager, executionIdentity, invokeWithRetryService, workspaceId, batchSize))
: this(new RsapiProvider(servicesManager, executionIdentity, invokeWithRetryService, workspaceId, batchSize), invokeWithRetryService)
{
this.invokeWithRetryService = invokeWithRetryService;
}

public RsapiDao(IRsapiProvider rsapiProvider)
public RsapiDao(IRsapiProvider rsapiProvider, InvokeWithRetryService invokeWithRetryService)
{
this.invokeWithRetryService = invokeWithRetryService;

this.rsapiProvider = rsapiProvider;
this.choiceCache = new ChoiceCache(this.rsapiProvider);
this.guidCache = new ArtifactGuidCache(this.rsapiProvider);
Expand Down
Loading

0 comments on commit 749081a

Please sign in to comment.