Skip to content

Commit

Permalink
test: use zipped projects (#918)
Browse files Browse the repository at this point in the history
* test: use zipped projects

Signed-off-by: Stephane Bouchet <[email protected]>

* test: use zipped projects

Signed-off-by: Stephane Bouchet <[email protected]>

---------

Signed-off-by: Stephane Bouchet <[email protected]>
  • Loading branch information
sbouchet authored Sep 26, 2024
1 parent 91c9bc7 commit a71743b
Show file tree
Hide file tree
Showing 45 changed files with 24 additions and 12,931 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@
******************************************************************************/
package org.jboss.tools.intellij.openshift.utils.odo;

import com.intellij.util.io.ZipUtil;
import com.redhat.devtools.intellij.common.utils.ExecHelper;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
Expand All @@ -30,12 +35,13 @@

@RunWith(Parameterized.class)
public class OdoCliComponentTest extends OdoCliTest {
private static final String COMPONENT_PATH = "src/it/projects/go";
private static final String PROJECT_NAME = "go";
private static final String COMPONENT_PATH = "src/it/projects/";
private final ComponentFeature feature;
private String project;
private String component;
private String service;
private final String projectPath = new File(COMPONENT_PATH).getAbsolutePath();
private final String projectPath = new File(COMPONENT_PATH + PROJECT_NAME).getAbsolutePath();

public OdoCliComponentTest(ComponentFeature feature, String label) {
this.feature = feature;
Expand All @@ -49,6 +55,18 @@ public static Iterable<Object[]> data() {
});
}

@BeforeClass
public static void initTestProject() throws IOException {
Path destDir = new File(COMPONENT_PATH).toPath();
Path srcFile = new File(COMPONENT_PATH + PROJECT_NAME + ".zip").toPath();
ZipUtil.extract(srcFile, destDir, null);
}

@AfterClass
public static void deleteTestProject() throws IOException {
FileUtils.deleteDirectory(new File(COMPONENT_PATH));
}

@Before
public void initTestEnv() throws IOException {
project = PROJECT_PREFIX + random.nextInt();
Expand Down Expand Up @@ -127,13 +145,16 @@ public void checkCreateComponentAndLinkService() throws IOException, ExecutionEx
Binding binding = odo.link(projectPath, target);
assertNotNull(binding);
List<Binding> bindings = odo.listBindings(projectPath);
assertNotNull(bindings);
assertEquals(1, bindings.size());
//cleanup
// cleanup
odo.deleteBinding(projectPath, binding.getName());
bindings = odo.listBindings(projectPath);
assertNotNull(bindings);
assertEquals(0, bindings.size());
odo.deleteService(project, deployedService);
deployedServices = odo.getServices(project);
assertNotNull(deployedServices);
assertEquals(0, deployedServices.size());
}

Expand Down
Binary file added src/it/projects/go.zip
Binary file not shown.
3 changes: 0 additions & 3 deletions src/it/projects/go/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions src/it/projects/go/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions src/it/projects/go/go.mod

This file was deleted.

15 changes: 0 additions & 15 deletions src/it/projects/go/main.go

This file was deleted.

Binary file added src/it/projects/nodejs.zip
Binary file not shown.
107 changes: 0 additions & 107 deletions src/it/projects/nodejs/.gitignore

This file was deleted.

Loading

0 comments on commit a71743b

Please sign in to comment.