Skip to content
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

Obsolete text field "attachment name..." #979

Closed
wants to merge 5 commits into from
Closed

Obsolete text field "attachment name..." #979

wants to merge 5 commits into from

Conversation

jhyle
Copy link

@jhyle jhyle commented Jan 28, 2016

See #865. This patch adds a js function that fills the attachement name field when a file is selected for upload. The user can change the name then. At upload, the name is taken for the attachement if given, the name of the uploaded file otherwise.

I had to add to suppress the ExcessiveImports warning, maybe create a puzzle for it?

@karato
Copy link
Collaborator

karato commented Jan 28, 2016

@jhyle Thanks, let me find someone who can review this pull request

@karato
Copy link
Collaborator

karato commented Jan 28, 2016

@krzyk review it

* @param dst File
* @throws IOException If fails
*/
private void copy(final Request src, final File dst) throws IOException {
Copy link

Choose a reason for hiding this comment

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

@jhyle instead of creating this method you can reuse Files.copy(src.body, dst.toPath())

@krzyk
Copy link

krzyk commented Jan 29, 2016

@jhyle please see my comments above and also a test would be nice

@@ -54,6 +55,7 @@
import org.takes.facets.forward.RsForward;
import org.takes.rq.RqHeaders;
import org.takes.rq.RqMultipart;
import org.takes.rq.RqMultipart.Smart;
Copy link

Choose a reason for hiding this comment

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

@jhyle don't use such imports, the correct class name should be RqMultipart.Smart, not just Smart

@jhyle
Copy link
Author

jhyle commented Jan 29, 2016

@krzyk Ok, I did the changes and added a puzzle for the missing test.

@krzyk
Copy link

krzyk commented Jan 29, 2016

@jhyle unfortunately we need to have the test first, implementation (or a part of it) could be in todo, but the test that recreates the problem reported has to exist

@jhyle
Copy link
Author

jhyle commented Jan 30, 2016

@krzyk @karato Ok, next time I do the test first and then do a puzzle for the change. Can I have additional 30 min for this one?

@jhyle
Copy link
Author

jhyle commented Jan 31, 2016

@karato ping

@jhyle
Copy link
Author

jhyle commented Feb 1, 2016

@karato Please give an answer.

@krzyk
Copy link

krzyk commented Feb 2, 2016

@jhyle I haven't seen a case where the budget was extended, you could try with Yegor. But basically, when you take a task you accept http://at.teamed.io/policy.html and specifically:

Each task has a pre-defined budget, in minutes, which is announced by the project manager. The budget is not negotiable. When the task is done, you’ll get a payment equal to the number of minutes in the budget multiplied by your hourly rate, no matter how much time you actually spent on it.

and this http://www.yegor256.com/2015/07/16/fools-dont-write-unit-tests.html

@karato
Copy link
Collaborator

karato commented Feb 3, 2016

@karato ping

@jhyle no, you can't have additional 30 minutes

@jhyle
Copy link
Author

jhyle commented Feb 4, 2016

@krzyk I added a test, but it fails with

org.takes.HttpException: [400] header "Content-Disposition" is mandatory
    at org.takes.rq.RqHeaders$Smart.single(RqHeaders.java:206)
    at org.takes.rq.RqMultipart$Base.asMap(RqMultipart.java:313)
    at org.takes.rq.RqMultipart$Base.buildRequests(RqMultipart.java:224)
    at org.takes.rq.RqMultipart$Base.<init>(RqMultipart.java:140)
    at org.takes.rq.RqMultipart$Fake.<init>(RqMultipart.java:413)
    at com.netbout.rest.bout.TkAttachTest.setAttachementName(TkAttachTest.java:203)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Can it be that the RqMultipart.Fake does not handle multiple dispositions correctly?

    /**
     * Take attachement name from name field if value is set.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void setAttachementName() throws Exception {
        final MkBase base = new MkBase();
        final String urn = "urn:test:3";
        final User user = base.user(new URN(urn));
        user.aliases().add("jeff3");
        final Alias alias = user.aliases().iterate().iterator().next();
        final long number = alias.inbox().start();
        final Bout bout = alias.inbox().bout(number);
        bout.friends().invite(alias.name());
        final String name = "test.jpg";
        final String filename = "tt.jpg";
        final RqWithAuth request = new RqWithAuth(
            urn,
            new RqMultipart.Fake(
                TkAttachTest.fake(number),
                new RqWithHeaders(
                    TkAttachTest.body(""),
                    String.format(TkAttachTest.POST_URL, number),
                    //@checkstyle LineLengthCheck (1 line)
                    String.format("Content-Disposition: form-data; name=\"file\"; filename=\"%s\"", filename),
                    "Content-Type: application/octet-stream"
                ),
                new RqWithHeaders(
                    TkAttachTest.body(name),
                    String.format(TkAttachTest.POST_URL, number),
                    "Content-Disposition: form-data; name=\"name\""
                )
            )
        );
        try {
            new FkBout(".++", new TkAttach(base)).route(request);
        } catch (final RsForward response) {
            MatcherAssert.assertThat(
                response,
                new HmRsStatus(HttpURLConnection.HTTP_SEE_OTHER)
            );
        }
        MatcherAssert.assertThat(
            bout.messages().iterate().iterator().next().text(),
            Matchers.containsString(String.format("attachment \"%s\"", name))
        );
    }

@krzyk
Copy link

krzyk commented Feb 4, 2016

@jhyle sorry I don't know, you would have to look at the code of this class

@jhyle
Copy link
Author

jhyle commented Feb 5, 2016

@karato @krzyk waiting for yegor256/takes#577

@karato
Copy link
Collaborator

karato commented Feb 8, 2016

@karato @krzyk waiting for yegor256/takes#577

@jhyle OK, take your time

@krzyk
Copy link

krzyk commented Feb 17, 2016

@jhyle maybe you could find another way to test this without use this class?

@jhyle
Copy link
Author

jhyle commented Feb 18, 2016

@krzyk Sorry, but I already invested a lot of time in this task. @karato Maybe it is possible to assign the task yegor256/takes#577 to me, so I can find out what is not working?

@krzyk
Copy link

krzyk commented Mar 20, 2016

@jhyle Are you planning to finish this? Generally tasks should be closed in under 10 days, if you can't do it in such time you should ask for reassignment.

@krzyk
Copy link

krzyk commented Mar 21, 2016

@jhyle Please close this PR if you are not planning to finish.

@krzyk
Copy link

krzyk commented Mar 23, 2016

@jhyle ping

@krzyk
Copy link

krzyk commented Mar 27, 2016

@jhyle please close this issue

@krzyk
Copy link

krzyk commented Mar 29, 2016

@dmzaytsev what should I do when @jhyle is not responding?

@dmzaytsev
Copy link
Contributor

@krzyk I think we just ask the PM to make it invalid, but in this case you won't be paid
or maybe @yegor256 can help here ?

@krzyk
Copy link

krzyk commented Mar 31, 2016

@yegor256 what should we do here, @jhyle is not responding, PR is waiting for 2 months. Should it be closed or invalidated?

@krzyk
Copy link

krzyk commented Apr 2, 2016

@jhyle ping

@yegor256
Copy link
Owner

yegor256 commented Apr 4, 2016

@dmzaytsev what do you think?

@dmzaytsev
Copy link
Contributor

@yegor256 I think you could close this PR due to @jhyle not responding for a while
I wouldn't like ask PM for a invalid label because the reviewer did a great job and should be paid

@yegor256
Copy link
Owner

yegor256 commented Apr 5, 2016

@dmzaytsev @krzyk I'm closing

@yegor256 yegor256 closed this Apr 5, 2016
@karato
Copy link
Collaborator

karato commented Apr 6, 2016

@ypshenychka please, check this issue for QA compliance, as per par.24

@ypshenychka
Copy link

@dmzaytsev

dmzaytsev commented 8 days ago
I think we just ask the PM to make it invalid, but in this case you won't be paid
or maybe @yegor256 can help here ?

According to our QA Rules:

Messages in a ticket always start with a name of a user they are addressed to.

Please correct your message by indicating an addressee in the beginning.

@dmzaytsev
Copy link
Contributor

@ypshenychka fixed

@ypshenychka
Copy link

@dmzaytsev Thank you.

@ypshenychka
Copy link

@karato Quality is acceptable.

@karato
Copy link
Collaborator

karato commented Apr 6, 2016

@karato Quality is acceptable.

@ypshenychka thanks, got it. everybody, please try to make it good next time

@karato
Copy link
Collaborator

karato commented Apr 6, 2016

@krzyk I added 10 mins to @ypshenychka (for QA review) in transaction 82738942. 32 mins added to your account (payment number 82738977), many thanks for your contribution! 1628 hours and 1 min spent here.. extra minutes for review comments (c=17). +32 added to your rating, at the moment it is: +5666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants