You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/10/20 07:18:18 UTC

[GitHub] [dolphinscheduler] zhongjiajie commented on a diff in pull request #10998: [Feature-10983] [refactor] ResourcesController

zhongjiajie commented on code in PR #10998:
URL: https://github.com/apache/dolphinscheduler/pull/10998#discussion_r1000231298


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/UpdateResourceResponse.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.api.dto.resources;
+
+import org.apache.dolphinscheduler.api.utils.Result;
+
+/**
+ * update resource response
+ */
+public class UpdateResourceResponse extends Result<Object> {
+
+    private Object data;
+
+    public UpdateResourceResponse(Result<Object> result) {
+        super();
+        this.setCode(result.getCode());
+        this.setMsg(result.getMsg());
+        this.setData(result.getData());
+    }
+
+    @Override
+    public Object getData() {
+        return data;
+    }
+
+    @Override
+    public void setData(Object data) {
+        this.data = data;
+    }
+}

Review Comment:
   about all the response, is an other Result object, maybe we can directly use result object, we already have some example, you can see `ScheduleV2Controller` as example



##########
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesV2ControllerTest.java:
##########
@@ -0,0 +1,485 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.api.controller;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import org.apache.dolphinscheduler.api.dto.resources.CreateResourceRequest;
+import org.apache.dolphinscheduler.api.dto.resources.CreateUdfRequest;
+import org.apache.dolphinscheduler.api.dto.resources.UpdateResourceContentRequest;
+import org.apache.dolphinscheduler.api.enums.Status;
+import org.apache.dolphinscheduler.api.service.ResourcesService;
+import org.apache.dolphinscheduler.api.service.UdfFuncService;
+import org.apache.dolphinscheduler.api.utils.Result;
+import org.apache.dolphinscheduler.common.enums.UdfType;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.spi.enums.ResourceType;
+
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;

Review Comment:
   please upgrade to Junit5, you can see exists tests in our codebase



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org