Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 15, 2018
2 parents 297a15f + 8a52d9b commit c0bf614
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/zerocracy/radars/github/RbOnClose.java
Expand Up @@ -50,10 +50,9 @@ public String react(final Farm farm, final Github github,
} else {
final Project project = new GhProject(farm, issue.repo());
new ClaimOut()
.type("Finish order")
.type("Close issue")
.token(new TokenOfIssue(issue))
.param("job", new Job(issue))
.param("reason", "GitHub issue was closed, order is finished.")
.postTo(project);
new ClaimOut()
.type("Remove job from WBS")
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/com/zerocracy/radars/q-tracker.xml
Expand Up @@ -79,4 +79,10 @@ SOFTWARE.
<label>status</label>
<help>Check the status of the job</help>
</cmd>
<!--
@todo #73:30min Add command to rate the quality, the format is
'quality is good|bad|acceptable', this command should trigger
'Finish order' with 'quality' param (see #73 comments for details)
and pay 15 min to QA user.
-->
</question>
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2016-2018 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zerocracy.stk.pm.in.orders

import com.jcabi.xml.XML
import com.zerocracy.farm.Assume
import com.zerocracy.jstk.Project
import com.zerocracy.pm.ClaimIn
import com.zerocracy.pm.staff.Roles
import java.security.SecureRandom

def exec(Project project, XML xml) {
new Assume(project, xml).notPmo()
new Assume(project, xml).type('Close issue')
def claim = new ClaimIn(xml)
def qa = new Roles(project).bootstrap().findByRole('QA')
if (qa.empty) {
claim.copy()
.type('Finish order')
.param('reason', 'GitHub issue was closed, order is finished.')
.postTo(project)
} else {
claim.copy()
.type('Assign QA')
.param('assignee', qa.size() > 1 ? qa[new SecureRandom().nextInt(qa.size() - 1)] : qa.first())
.postTo(project)
}
}
36 changes: 36 additions & 0 deletions src/main/resources/com/zerocracy/stk/pm/qa/assign_qa.groovy
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2016-2018 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zerocracy.stk.pm.qa

import com.jcabi.xml.XML
import com.zerocracy.Par
import com.zerocracy.farm.Assume
import com.zerocracy.jstk.Project
import com.zerocracy.pm.ClaimIn
import com.zerocracy.pm.scope.Wbs

def exec(Project project, XML xml) {
new Assume(project, xml).notPmo()
new Assume(project, xml).type('Assign QA')
def claim = new ClaimIn(xml)
def job = claim.param('job')
new Wbs(project).bootstrap().add(job)
claim.reply(
new Par('@%s please review this job as in §30.')
.say(claim.param('assignee'))
)
}
1 change: 0 additions & 1 deletion src/test/java/com/zerocracy/pm/in/OrdersTest.java
Expand Up @@ -38,5 +38,4 @@ public void assignsAndResigns() throws Exception {
new Wbs(project).bootstrap().add(job);
orders.assign(job, "yegor256", "just for fun");
}

}
@@ -0,0 +1,30 @@
/**
* Copyright (c) 2016-2018 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zerocracy.bundles.assign_qa_user

import com.jcabi.xml.XML
import com.zerocracy.jstk.Project
import com.zerocracy.pm.scope.Wbs
import org.hamcrest.MatcherAssert
import org.hamcrest.Matchers

def exec(Project project, XML xml) {
MatcherAssert.assertThat(
new Wbs(project).bootstrap().role('gh:test/test#1'),
Matchers.equalTo('DEV')
)
}
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2016-2018 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zerocracy.bundles.assign_qa_user

import com.jcabi.github.Github
import com.jcabi.github.Issue
import com.jcabi.github.Repos
import com.jcabi.xml.XML
import com.zerocracy.entry.ExtGithub
import com.zerocracy.jstk.Farm
import com.zerocracy.jstk.Project

def exec(Project project, XML xml) {
Farm farm = binding.variables.farm
Github github = new ExtGithub(farm).value()
def repo = github.repos().create(new Repos.RepoCreate('test', false))
new Issue.Smart(repo.issues().create('Hello, world', ''))
}
29 changes: 29 additions & 0 deletions src/test/resources/com/zerocracy/bundles/assign_qa_user/claims.xml
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016-2018 Zerocracy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to read
the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<claims xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/zerocracy/datum/0.37/xsd/pm/claims.xsd" version="0.1" updated="2017-03-27T11:18:09.228Z">
<claim id="3">
<created>2017-03-27T11:18:09.228Z</created>
<type>Close issue</type>
<author>yegor256</author>
<token>test;C123;yegor256</token>
<params>
<param name="login">yegor256</param>
<param name="job">gh:test/test#1</param>
</params>
</claim>
</claims>
25 changes: 25 additions & 0 deletions src/test/resources/com/zerocracy/bundles/assign_qa_user/people.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016-2018 Zerocracy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to read
the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/zerocracy/datum/0.37/xsd/pmo/people.xsd" version="1" updated="2016-12-29T09:03:21.684Z">
<person id="test">
<mentor>yegor256</mentor>
</person>
<person id="yegor256">
<mentor>yegor256</mentor>
</person>
</people>
25 changes: 25 additions & 0 deletions src/test/resources/com/zerocracy/bundles/assign_qa_user/roles.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016-2018 Zerocracy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to read
the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<roles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/zerocracy/datum/0.37/xsd/pm/staff/roles.xsd" version="0.1" updated="2017-03-27T11:18:09.228Z">
<person id="yegor256">
<role>ARC</role>
</person>
<person id="test">
<role>QA</role>
</person>
</roles>

1 comment on commit c0bf614

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on c0bf614 Jan 15, 2018

Choose a reason for hiding this comment

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

Puzzle 73-6d39317c discovered in src/main/resources/com/zerocracy/radars/q-tracker.xml and submitted as #408. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

Please sign in to comment.