Skip to content

Commit

Permalink
write a line into test.file
Browse files Browse the repository at this point in the history
  • Loading branch information
huifer committed Sep 8, 2023
1 parent d048ae1 commit 6b65fb4
Show file tree
Hide file tree
Showing 13 changed files with 1,201 additions and 0 deletions.
623 changes: 623 additions & 0 deletions docs/spring/cs126c9aac-4de8-11ee-a0aa-acde48001122.java

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions docs/spring/cs12a6a396-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.resultmapwithassociationstest;

import java.util.List;

public interface Mapper {
List<Person> findAll();
}
39 changes: 39 additions & 0 deletions docs/spring/cs12e06126-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 2009-2015 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.resultmapwithassociationstest;

import java.util.List;

public class Person {
private int id;
private List<Address> addresses;

public int getId() {
return id;
}

public void setId(final int id) {
this.id = id;
}

public List<Address> getAddresses() {
return addresses;
}

public void setAddresses(final List<Address> addresses) {
this.addresses = addresses;
}
}
50 changes: 50 additions & 0 deletions docs/spring/cs131a0552-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.constructor_columnprefix;

public class EntityKey {
private Integer id;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EntityKey other = (EntityKey) obj;
if (id == null) {
return other.id == null;
} else return id.equals(other.id);
}
}
78 changes: 78 additions & 0 deletions docs/spring/cs1354c944-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.type;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

class ObjectTypeHandlerTest extends BaseTypeHandlerTest {

private static final TypeHandler<Object> TYPE_HANDLER = new ObjectTypeHandler();

@Override
@Test
public void shouldSetParameter() throws Exception {
TYPE_HANDLER.setParameter(ps, 1, "Hello", null);
verify(ps).setObject(1, "Hello");
}

@Override
@Test
public void shouldGetResultFromResultSetByName() throws Exception {
when(rs.getObject("column")).thenReturn("Hello");
assertEquals("Hello", TYPE_HANDLER.getResult(rs, "column"));
}

@Override
@Test
public void shouldGetResultNullFromResultSetByName() throws Exception {
when(rs.getObject("column")).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(rs, "column"));
}

@Override
@Test
public void shouldGetResultFromResultSetByPosition() throws Exception {
when(rs.getObject(1)).thenReturn("Hello");
assertEquals("Hello", TYPE_HANDLER.getResult(rs, 1));
}

@Override
@Test
public void shouldGetResultNullFromResultSetByPosition() throws Exception {
when(rs.getObject(1)).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(rs, 1));
}

@Override
@Test
public void shouldGetResultFromCallableStatement() throws Exception {
when(cs.getObject(1)).thenReturn("Hello");
assertEquals("Hello", TYPE_HANDLER.getResult(cs, 1));
}

@Override
@Test
public void shouldGetResultNullFromCallableStatement() throws Exception {
when(cs.getObject(1)).thenReturn(null);
assertNull(TYPE_HANDLER.getResult(cs, 1));
}

}
39 changes: 39 additions & 0 deletions docs/spring/cs138f634c-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.permissions;

public class Permission {

private String permission;
private Resource resource;

public String getPermission() {
return permission;
}

public void setPermission(String permission) {
this.permission = permission;
}

public Resource getResource() {
return resource;
}

public void setResource(Resource resource) {
this.resource = resource;
}

}
55 changes: 55 additions & 0 deletions docs/spring/cs13c92ffa-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.domain.blog;

public class PostLiteId {
private int id;

public PostLiteId() {

}

public PostLiteId(int aId) {
id = aId;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

final PostLiteId that = (PostLiteId) o;

return id == that.id;
}

@Override
public int hashCode() {
return id;
}
}
76 changes: 76 additions & 0 deletions docs/spring/cs14034d20-4de8-11ee-a0aa-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.type;

import java.io.InputStream;
import java.sql.*;

/**
* The {@link TypeHandler} for {@link Blob}/{@link InputStream} using method supported at JDBC 4.0.
* @since 3.4.0
* @author Kazuki Shimizu
*/
public class BlobInputStreamTypeHandler extends BaseTypeHandler<InputStream> {

/**
* Set an {@link InputStream} into {@link PreparedStatement}.
* @see PreparedStatement#setBlob(int, InputStream)
*/
@Override
public void setNonNullParameter(PreparedStatement ps, int i, InputStream parameter, JdbcType jdbcType)
throws SQLException {
ps.setBlob(i, parameter);
}

/**
* Get an {@link InputStream} that corresponds to a specified column name from {@link ResultSet}.
* @see ResultSet#getBlob(String)
*/
@Override
public InputStream getNullableResult(ResultSet rs, String columnName)
throws SQLException {
return toInputStream(rs.getBlob(columnName));
}

/**
* Get an {@link InputStream} that corresponds to a specified column index from {@link ResultSet}.
* @see ResultSet#getBlob(int)
*/
@Override
public InputStream getNullableResult(ResultSet rs, int columnIndex)
throws SQLException {
return toInputStream(rs.getBlob(columnIndex));
}

/**
* Get an {@link InputStream} that corresponds to a specified column index from {@link CallableStatement}.
* @see CallableStatement#getBlob(int)
*/
@Override
public InputStream getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
return toInputStream(cs.getBlob(columnIndex));
}

private InputStream toInputStream(Blob blob) throws SQLException {
if (blob == null) {
return null;
} else {
return blob.getBinaryStream();
}
}

}
Loading

0 comments on commit 6b65fb4

Please sign in to comment.