Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-499: Ensure concourse-import and concourse-export are invertible and comply with standards (e.g., CSV escaping) #513

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2013-2024 Cinchapi Inc.
*
* 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 com.cinchapi.concourse.ete.bugrepro;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import java.util.Set;

import org.junit.Assert;
import org.junit.Test;

import com.cinchapi.common.base.Array;
import com.cinchapi.concourse.test.ClientServerTest;
import com.cinchapi.concourse.util.FileOps;
import com.cinchapi.concourse.util.Resources;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

/**
* Unit tests to validate that exported data can be imported as is.
*
* @author Jeff Nelson
*/
public class GH499 extends ClientServerTest {

@Test
public void reproGH_499() {
String coverLetter = FileOps
.read(Resources.getAbsolutePath("/cover-letter.txt"));
Map<String, Object> data = ImmutableMap.of("name", "Jeff Nelson",
"coverLetter", coverLetter, "age", ImmutableList.of(1, 2));
long record = client.insert(data);
Map<String, Set<Object>> expected = client.select(record);
Path file = Paths.get(FileOps.tempFile());
server.executeCli("export",
"--file " + file.toString()
+ " --username admin --password admin --port "
+ server.getClientPort());
FileOps.readLines(file.toString()).forEach(System.out::println);
System.out.println(server.executeCli("import",
Array.containing("--data", file.toString(), "-e", "test",
"--username", "admin", "--password", "admin", "--port",
Integer.toString(server.getClientPort()))));
client = server.connect("admin", "admin", "test");
Map<String, Set<Object>> actual = client
.select(client.inventory().iterator().next());
Assert.assertEquals(expected, actual);
}

@Override
protected String getServerVersion() {
return ClientServerTest.LATEST_SNAPSHOT_VERSION;
}

}
3 changes: 3 additions & 0 deletions concourse-ete-tests/src/test/resources/cover-letter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p class="ql-align-justify">Redacted Name</p><p class="ql-align-justify">1600 Harden Street</p><p class="ql-align-justify">Columbia, SC, 29204</p><p class="ql-align-justify">386-627-6912</p><p class="ql-align-justify"><a href="mailto:redacted@gmail.com" rel="noopener noreferrer" target="_blank">redacted@gmail.com</a></p><p class="ql-align-justify">lionxmedia.com</p><p class="ql-align-justify"><br></p><p class="ql-align-justify">Dear Sir/Madam</p><p class="ql-align-justify"><br></p><p class="ql-align-justify"> I am writing to express my profound interest in the Marketing Research internship position at TripleLift. My experience last year with the company was one I will always remember. As a Mass Communications student at Benedict College’s School of Arts &amp; Sciences expecting to graduate in December of 2024, I am eager to join your team and gain hands-on experience, develop skills, and build a network in the corporate industry. After seeing your internship posted on Handshake, I am excited to apply for a chance to share the multimedia and graphic design skills I have gained to benefit your organization. </p><p class="ql-align-justify"> Through coursework in both digital media and literature and previous experience using Adobe Photoshop, Lightroom, InDesign, and Premiere Pro, I have developed written, oral, and digital communication skills – all I believe may be critical to working in the production industry. Through the courses I have completed at Benedict College in the past two years, including but not limited to; Basic Photography, Oral Communication, Photo for Web &amp; social media, I have strengthened my editorial, presentation, teamwork, production, and photography skills. Additionally, as a Junior Media Specialist for Your Faith Recruitment &amp; Education Consultants, and the Webmaster for the Xi Beta Chapter of Phi Mu Alpha Sinfonia Music Fraternity of America, I am constantly developing production skills and proficiency in dealing with the public and working under pressure.&nbsp;</p><p class="ql-align-justify">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Attached are my resume and personal portfolio link lionxmedia.com where some of my past and recent graphic design and photography projects are displayed. Thank you for this opportunity and for considering me as a candidate for the Production Assistant internship program. I look forward to hearing from you and becoming a valuable part of your team.</p><p class="ql-align-justify">Sincerely,</p><p class="ql-align-justify"><img src="//:0" alt="Shape

Description automatically generated with medium confidence" height="34" width="102"></p><p class="ql-align-justify">Redacted Name</p><p><br></p>