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

HBX-2390: Create a JBoss Tools adaptation layer in Hibernate Tools #4269

Merged
merged 1 commit into from
Jul 1, 2023
Merged
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
@@ -1,11 +1,18 @@
package org.hibernate.tool.orm.jbt.wrp;

import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.Table;

public class TableWrapper extends Table implements Wrapper {

public TableWrapper(String name) {
super("HibernateTools", name);
}

@Override
public KeyValue getIdentifierValue() {
KeyValue result = super.getIdentifierValue();
return result == null ? null : (KeyValue)ValueWrapperFactory.createValueWrapper(result);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;

import org.hibernate.mapping.BasicValue;
import org.hibernate.mapping.KeyValue;
import org.hibernate.tool.orm.jbt.util.DummyMetadataBuildingContext;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -13,12 +17,21 @@ public class TableWrapperTest {
@BeforeEach
public void beforeEach() {
tableWrapper = new TableWrapper("foo");
KeyValue v = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
tableWrapper.setIdentifierValue(v);
}

@Test
public void testConstruction() {
assertNotNull(tableWrapper);
assertEquals("foo", tableWrapper.getName());
}

@Test
public void testGetIdentifierValue() {
KeyValue v = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
tableWrapper.setIdentifierValue(v);
assertSame(v, ((Wrapper)tableWrapper.getIdentifierValue()).getWrappedObject());
}

}