Skip to content

Conversation

@ajarnold87
Copy link

Implemented #324 Please let me know your thoughts or if any recommended changes need to be made.

Copy link
Contributor

@stephenc stephenc left a comment

Choose a reason for hiding this comment

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

@aheritier can you remove me from the code owners as I’m not actively using the Zendesk client

Copy link
Contributor

@aheritier aheritier left a comment

Choose a reason for hiding this comment

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

Very good work @ajarnold87
You have one bug in the test and you might add a vararg method to ease the usage but otherwise it's good

@@ -1,5 +1,31 @@
package org.zendesk.client.v2;

import static org.hamcrest.CoreMatchers.anyOf;
Copy link
Contributor

Choose a reason for hiding this comment

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

@ajarnold87 it might be better to not reorganise the imports. You can see if your IDE is correctly configured here:

https://github.com/cloudbees/zendesk-java-client/blob/master/CONTRIBUTING.adoc#ide-configuration

}
}

@Test(timeout = 10000)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot to add some test, it's helping a lot @ajarnold87

user2.setEmail("example+user2$example.com");
user2.setName("Norris Chuck");

JobStatus<User> result = instance.createUsers(user1, user2);
Copy link
Contributor

Choose a reason for hiding this comment

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

you are testing the createUsers method but you added createOrUpdateUsers

Copy link
Contributor

Choose a reason for hiding this comment

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

not your fault but there is no test for createUsers 😢

return complete(createUsersAsync(users));
}

public JobStatus<User> createOrUpdateUsers(List<User> users) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be useful to add varargs version like for createUsers:

    public JobStatus<User> createOrUpdateUsers(User... users) {
        return createOrUpdateUsers(Arrays.asList(users));
    }

user1.setName("Chuck Norris");

User user2 = new User();
user2.setEmail("example+user2$example.com");
Copy link
Contributor

Choose a reason for hiding this comment

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

The email is not valid and thus the test is failing. My understanding is that the email isn't valid thus the account is not created.
But we still receive 2 users in the result (well done zendesk !). The user we failed to create is returned as an empty user with id = 1
Then when we cleanup/delete the user we created in the test we are failing with

createOrUpdateUsers(org.zendesk.client.v2.RealSmokeTest)  Time elapsed: 1.836 sec  <<< ERROR!
org.zendesk.client.v2.ZendeskResponseException: HTTP/404: Not Found - {"error":"RecordNotFound","description":"Not found"}
	at org.zendesk.client.v2.Zendesk.complete(Zendesk.java:2567)
	at org.zendesk.client.v2.Zendesk.deleteUser(Zendesk.java:835)
	at org.zendesk.client.v2.Zendesk.deleteUser(Zendesk.java:831)
	at org.zendesk.client.v2.RealSmokeTest.createOrUpdateUsers(RealSmokeTest.java:808)
Caused by: org.zendesk.client.v2.ZendeskResponseException: HTTP/404: Not Found - {"error":"RecordNotFound","description":"Not found"}
	at org.zendesk.client.v2.Zendesk$1.onCompleted(Zendesk.java:2262)
	at org.zendesk.client.v2.Zendesk$1.onCompleted(Zendesk.java:2253)
	at org.asynchttpclient.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:66)
	at org.asynchttpclient.netty.NettyResponseFuture.loadContent(NettyResponseFuture.java:222)
	at org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:257)
	at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.finishUpdate(AsyncHttpClientHandler.java:241)
	at org.asynchttpclient.netty.handler.HttpHandler.handleChunk(HttpHandler.java:114)
	at org.asynchttpclient.netty.handler.HttpHandler.handleRead(HttpHandler.java:143)
	at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1224)
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1271)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514)
	at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

RecordNotFound because there is no user with ID= 1 to delete

@aheritier
Copy link
Contributor

Hi @ajarnold87

Do my comments are helping you ?

@aheritier
Copy link
Contributor

Should be fixed with #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants