Skip to content

Commit

Permalink
Add csv generator tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nakag committed Apr 30, 2019
1 parent 70871ef commit 0e17806
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/tmdmaker.ui.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ Require-Bundle: org.eclipse.swtbot.eclipse.finder,
tmdmaker.imagegenerator,
tmdmaker.sphinx,
tmdmaker.ddlgenerator,
tmdmaker.htmlgenerator
tmdmaker.htmlgenerator,
tmdmaker.csv
Automatic-Module-Name: tmdmaker.ui.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2009-2019 TMD-Maker Project <https://tmdmaker.osdn.jp/>
*
* Licensed 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 jp.sourceforge.tmdmaker.ui.editor;

import java.io.File;

import org.eclipse.core.runtime.Platform;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;

import jp.sourceforge.tmdmaker.generate.csv.attributelist.AttributeListCsvGenerator;

/**
* TMD-MakerのAttributeListCsvGeneratorテスト.
*
* SWTBotがMessageDialogに対応していないので内部クラスを直接実行している.
*
* @author nakag
*
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class CSVGeneratorTest extends AbstractUITest {
AttributeListCsvGenerator generator;
String rootDir;

@Override
public void setUp() throws Exception {
super.setUp();
createEntity(50, 50, "顧客番号", 0);
createEntity(300, 50, "商品番号", 0);
// R:R 対照表
botEditor.activateTool("Relationship");
botEditor.click(55, 55);
botEditor.click(305, 55);
wait.waitFor(10);
generator = new AttributeListCsvGenerator();
rootDir = Platform.getInstanceLocation().getURL().getPath() + projectName();
}

@Test
public void testAttributeList() {
generator.execute(rootDir, tmdEditor.getRootModel().findEntityModel());
String docPath = rootDir + File.separator + "attribute_list.csv";
assertEquals(true, new File(docPath).exists());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void setUp() throws Exception {
botEditor.activateTool("Relationship");
botEditor.click(55, 55);
botEditor.click(305, 55);
sleep();
wait.waitFor(10);
generator = new DdlUtilsDDLGenerator();
rootDir = Platform.getInstanceLocation().getURL().getPath() + projectName();
Expand Down

0 comments on commit 0e17806

Please sign in to comment.