You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datalab.apache.org by GitBox <gi...@apache.org> on 2020/11/09 13:39:46 UTC

[GitHub] [incubator-datalab] ofuks commented on a change in pull request #964: [DLAB-2116] Oduhu unitests

ofuks commented on a change in pull request #964:
URL: https://github.com/apache/incubator-datalab/pull/964#discussion_r519809009



##########
File path: services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/OdahuServiceImplTest.java
##########
@@ -0,0 +1,240 @@
+/*
+ * 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 com.epam.dlab.backendapi.service.impl;
+
+import com.epam.dlab.auth.UserInfo;
+import com.epam.dlab.backendapi.dao.OdahuDAO;
+import com.epam.dlab.backendapi.domain.*;
+import com.epam.dlab.backendapi.service.EndpointService;
+import com.epam.dlab.backendapi.service.ProjectService;
+import com.epam.dlab.backendapi.util.RequestBuilder;
+import com.epam.dlab.cloud.CloudProvider;
+import com.epam.dlab.dto.UserInstanceStatus;
+import com.epam.dlab.dto.base.edge.EdgeInfo;
+import com.epam.dlab.exceptions.DlabException;
+import com.epam.dlab.exceptions.ResourceConflictException;
+import com.epam.dlab.rest.client.RESTService;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.*;
+
+import static java.util.Collections.singletonList;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OdahuServiceImplTest {
+
+    private static final String USER = "testUser";
+    private static final String TOKEN = "testToken";
+    private static final String PROJECT = "testProject";
+    private static final String END_POINT_URL = "https://localhsot:8080/";
+    private static final String END_POINT_NAME = "testEndpoint";
+    private static final String tag = "testTag";
+    private static final String uuid = "34dsr324";
+    private static final String ODAHU_NAME = "odahuTest";
+    private static UserInfo userInfo;
+
+    @Mock
+    private OdahuDAO odahuDAO;
+
+    @Mock
+    private ProjectService projectService;
+
+    @Mock
+    private EndpointService endpointService;
+
+    @Mock
+    private RequestId requestId;
+
+    @Mock
+    private RESTService provisioningService;
+
+    @Mock
+    private RequestBuilder requestBuilder;
+
+    @InjectMocks
+    private OdahuServiceImpl odahuService;

Review comment:
       Please remove empty lines between variables

##########
File path: services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/OdahuServiceImplTest.java
##########
@@ -0,0 +1,240 @@
+/*
+ * 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 com.epam.dlab.backendapi.service.impl;
+
+import com.epam.dlab.auth.UserInfo;
+import com.epam.dlab.backendapi.dao.OdahuDAO;
+import com.epam.dlab.backendapi.domain.*;
+import com.epam.dlab.backendapi.service.EndpointService;
+import com.epam.dlab.backendapi.service.ProjectService;
+import com.epam.dlab.backendapi.util.RequestBuilder;
+import com.epam.dlab.cloud.CloudProvider;
+import com.epam.dlab.dto.UserInstanceStatus;
+import com.epam.dlab.dto.base.edge.EdgeInfo;
+import com.epam.dlab.exceptions.DlabException;
+import com.epam.dlab.exceptions.ResourceConflictException;
+import com.epam.dlab.rest.client.RESTService;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.*;
+
+import static java.util.Collections.singletonList;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OdahuServiceImplTest {
+
+    private static final String USER = "testUser";
+    private static final String TOKEN = "testToken";
+    private static final String PROJECT = "testProject";
+    private static final String END_POINT_URL = "https://localhsot:8080/";
+    private static final String END_POINT_NAME = "testEndpoint";
+    private static final String tag = "testTag";
+    private static final String uuid = "34dsr324";
+    private static final String ODAHU_NAME = "odahuTest";
+    private static UserInfo userInfo;
+
+    @Mock
+    private OdahuDAO odahuDAO;
+
+    @Mock
+    private ProjectService projectService;
+
+    @Mock
+    private EndpointService endpointService;
+
+    @Mock
+    private RequestId requestId;
+
+    @Mock
+    private RESTService provisioningService;
+
+    @Mock
+    private RequestBuilder requestBuilder;
+
+    @InjectMocks
+    private OdahuServiceImpl odahuService;
+
+    @BeforeClass
+    public static void setUp(){
+        userInfo = new UserInfo(USER, TOKEN);
+    }
+
+    @Test
+    public void findOdahuTest() {
+        List<OdahuDTO> odahuDTOList = odahuService.findOdahu();

Review comment:
       Do we want to verify **odahuDAO** method execution?

##########
File path: services/self-service/src/test/java/com/epam/dlab/backendapi/service/impl/OdahuServiceImplTest.java
##########
@@ -0,0 +1,240 @@
+/*
+ * 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 com.epam.dlab.backendapi.service.impl;
+
+import com.epam.dlab.auth.UserInfo;
+import com.epam.dlab.backendapi.dao.OdahuDAO;
+import com.epam.dlab.backendapi.domain.*;
+import com.epam.dlab.backendapi.service.EndpointService;
+import com.epam.dlab.backendapi.service.ProjectService;
+import com.epam.dlab.backendapi.util.RequestBuilder;
+import com.epam.dlab.cloud.CloudProvider;
+import com.epam.dlab.dto.UserInstanceStatus;
+import com.epam.dlab.dto.base.edge.EdgeInfo;
+import com.epam.dlab.exceptions.DlabException;
+import com.epam.dlab.exceptions.ResourceConflictException;
+import com.epam.dlab.rest.client.RESTService;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.util.*;
+
+import static java.util.Collections.singletonList;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.*;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OdahuServiceImplTest {
+
+    private static final String USER = "testUser";
+    private static final String TOKEN = "testToken";
+    private static final String PROJECT = "testProject";
+    private static final String END_POINT_URL = "https://localhsot:8080/";
+    private static final String END_POINT_NAME = "testEndpoint";

Review comment:
       **END_POINT_NAME** -> **ENDPOINT_NAME**
   **END_POINT_URL** -> **ENDPOINT_URL**




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@datalab.apache.org
For additional commands, e-mail: dev-help@datalab.apache.org